我希望从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
})
}
)
干杯,
答案 0 :(得分:0)
您可以在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
})
}
)