【问题标题】:User input from inputText stored as a variable来自 inputText 的用户输入存储为变量
【发布时间】:2017-01-07 13:21:02
【问题描述】:

我希望从 inputText 框中获取两个用户输入,并将它们存储在一个变量中,以便在使用 actionButton 提交后使用。

这是我的用户界面:

shinyUI(fluidPage(
  titlePanel("Sandbox"),
  sidebarLayout(
    sidebarPanel(("Predictive Pick Date"),
      textInput("InputCI", "Enter confidence % level", "95"),
      textInput("InputReqDM", "Enter required DM %", "15"),
      actionButton("submit", "Submit")),

    mainPanel("Blocks")

  )
))

这是我的服务器:

library(shiny)
library(leaflet)
library(splancs)
library(sp)
library(ggplot2)
library(shiny)
library(shinydashboard)

shinyServer(
  function(input, output, session){ #pDMInput is the user input for what DM% they are aiming for

    values <- reactiveValues(variable = NA)

    observe({
      CI <- input$InputCI
      ReqDM <- input$InputReqDM
    })
  }
)

干杯,

【问题讨论】:

  • 使用values$CI &lt;- input$InputCI

标签: r variables shiny


【解决方案1】:

你可以在 server.R 部分试试这个

shinyServer(
            function(input, output, session){ #pDMInput is the user input for what DM% they are aiming for
                    CI <- eventReactive(input$submit, {
                            input$InputCI
                    })
                    ReqDM <- eventReactive(input$submit, {
                            input$InputReqDM
                    })

            }
    )

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-22
    • 2015-05-16
    • 2022-11-02
    • 2018-09-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多