簡體   English   中英

R Shiny服務器dateRangeInput錯誤

[英]R Shiny server dateRangeInput error

我一直在發現這個錯誤

錯誤:每當我嘗試運行以下應用程序時,找不到函數“dateRangeInput”。

server.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. 我見過的所有例子都有效,為什么這個不起作用呢?

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進程。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM