【问题标题】:R Shiny server dateRangeInput errorR闪亮的服务器dateRangeInput错误
【发布时间】:2013-05-16 12:33:57
【问题描述】:

我一直发现这个错误

错误:每当我尝试运行以下应用程序时,都找不到函数“dateRangeInput”。

服务器.R


library(shiny)
library(ggplot2)
library(shinyExt)

shinyServer(function(input, output, session) { 

output$date  <- renderText({ as.character(input$date)  })
output$daterange  <- renderText({ as.character(input$daterange) })

observe({
updateDateInput(session, 'date_controlled',
                value = as.character(input$date),
                min = as.character(input$daterange[1]),
                max = as.character(input$daterange[2])
)

updateDateRangeInput(session, 'daterange_controlled',
                     min = as.character(input$daterange[1]),
                     max = as.character(input$daterange[2]),
                     start = as.character(input$daterange2[1]),
                     end = as.character(input$daterange2[2])
)

})  
})

我的 ui.R


library(shiny)
library(ggplot2)
library(shinyExt)

# Define UI for application that plots random distributions 
shinyUI(pageWithSidebar(

# Application title
headerPanel("KEMRI Wellcome Trust Programme"),

# Sidebar with a slider input for number of observations
sidebarPanel(
imageOutput("logo", height = "153px", width="272px"),
helpText("Note: while the data view will show only the specified",
         "number of observations, the summary will still be based",
         "on the full dataset."),

selectInput("graph", "Choose a graph:", 
            list("Histogram" = "hist", 
                 "Pie Chart" = "pie", 
                 "Time Series" = "time",
                 "Box Plot"="box",
                 "Violin Plot"="violin")),
dateRangeInput('daterange',
               label = 'Date range: dd/mm/yy, en, range limit, weekstart=1. Controls start and end of date range input in main panel.',
               start = Sys.Date()-1, end = Sys.Date()+1,
               min = Sys.Date()-10, max = Sys.Date()+10,
               separator = " - ",
               format = "dd/mm/yy", startview = 'year', language = 'en', weekstart = 1),

 submitButton("Update View")
 #sliderInput("obs","Number of observations:", min = 0, max = 1000, value = 500)
 ),

 # Show a plot of the generated distribution
 mainPanel(
    dateInput("date_controlled",
          "Date input controlled from sidebar"),
   dateRangeInput("daterange_controlled",
               "Date range input controlled from sidebar")   
  )
 ))

可能是什么问题?我正在使用最新的稳定闪亮服务器和 R 3.0.x。我见过的所有示例都有效,那么为什么这个无效呢?

【问题讨论】:

标签: r shiny


【解决方案1】:

dateRangeInput 的 Shiny 版本比 CRAN 上的版本更新。您可以通过以下步骤从 Shiny 的 GitHub 存储库安装:

install.packages('httpuv', repos=c(RStudio='http://rstudio.org/_packages', CRAN='http://cran.rstudio.com'))
install.packages('devtools')  # if you don't already have devtools installed
devtools::install_github('shiny', 'rstudio')

按照这些步骤操作后,请务必重新启动您的 R 进程,然后再重试。

【讨论】:

  • ... 这给了我错误:对于之前有效的所有闪亮示例,找不到对象'.setDummyField'。
  • 到目前为止,dateRangeInput 在 CRAN 上的 Shiny 版本中不再是这种情况
猜你喜欢
  • 2021-01-04
  • 2015-10-22
  • 2014-05-06
  • 1970-01-01
  • 1970-01-01
  • 2014-11-26
  • 2020-03-19
  • 2013-02-08
  • 1970-01-01
相关资源
最近更新 更多