简体   繁体   English

R-闪亮应用

[英]R-Shiny Application

I am trying to build a shiny application where a user can input a date through the shiny application to then to trigger an R script to leverage that date.我正在尝试构建一个 shiny 应用程序,其中用户可以通过 shiny 应用程序输入日期,然后触发 R 脚本来利用该日期。
I was wondering how do you link the date input from shiny to be leverage in an R script?我想知道如何将 shiny 的日期输入链接到 R 脚本中?

function(input, output) {
  # You can access the value of the widget with input$date, e.g.
  output$value <- renderPrint({ input$date })
}

Here's a minimal working example:这是一个最小的工作示例:

library(shiny)

ui <- fluidPage(
    dateRangeInput("date","Date:"),
    textOutput("value")
)

server <- function(input, output) {
    output$value <- renderPrint({ 
        x <- input$date
        # script using x goes here
        paste("choice:",x[1],"to",x[2]) # example output
        })
}
 
shinyApp(ui = ui, server = server)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM