滑块输入日期非数字到二进制问题
Slider input dates non-numeric to binary issue
我正在尝试在 R shiny 中的这些日期之间创建一个滑块输入。每次,我都会收到此错误:
警告:- 中的错误:二元运算符的非数字参数
[没有可用的堆栈跟踪]
这是应用程序中的输出,而不是滑块:non-numeric argument to binary operator
然而,我见过无数这样的例子(即 https://github.com/eparker12/nCoV_tracker/blob/master/app.R),所以我不明白为什么这不起作用。我有库 Lubridate、Shiny 和 ShinyWidgets,并将它们更新到最新版本。
ui=fluidPage(
uiOutput("plot_date_page1"),
)
server=function(input,output,session){
output$plot_date_page1<-renderUI({
sliderInput("plot_date_page1","Date",
label = h5("Select mapping date"),
min = as.Date("1980-01-01","%Y-%m-%d"),
max = as.Date("2020-01-01","%Y-%m-%d"),
value = as.Date("2020-01-01"),
timeFormat = "%y %b")
})
}
shinyApp(ui = ui, server = server)
您犯了一个简单的错误:Date
被隐含地视为 step
参数(您明确指定了 label
),这显然没有意义。你想用 Date
指定什么?
ui=fluidPage(
uiOutput("plot_date_page1"),
)
server=function(input,output,session){
output$plot_date_page1<-renderUI({
sliderInput("plot_date_page1",
# step = "Date",
label = h5("Select mapping date"),
min = as.Date("1980-01-01","%Y-%m-%d"),
max = as.Date("2020-01-01","%Y-%m-%d"),
value = as.Date("2020-01-01"),
timeFormat = "%y %b")
})
}
shinyApp(ui = ui, server = server)
我正在尝试在 R shiny 中的这些日期之间创建一个滑块输入。每次,我都会收到此错误: 警告:- 中的错误:二元运算符的非数字参数 [没有可用的堆栈跟踪]
这是应用程序中的输出,而不是滑块:non-numeric argument to binary operator
然而,我见过无数这样的例子(即 https://github.com/eparker12/nCoV_tracker/blob/master/app.R),所以我不明白为什么这不起作用。我有库 Lubridate、Shiny 和 ShinyWidgets,并将它们更新到最新版本。
ui=fluidPage(
uiOutput("plot_date_page1"),
)
server=function(input,output,session){
output$plot_date_page1<-renderUI({
sliderInput("plot_date_page1","Date",
label = h5("Select mapping date"),
min = as.Date("1980-01-01","%Y-%m-%d"),
max = as.Date("2020-01-01","%Y-%m-%d"),
value = as.Date("2020-01-01"),
timeFormat = "%y %b")
})
}
shinyApp(ui = ui, server = server)
您犯了一个简单的错误:Date
被隐含地视为 step
参数(您明确指定了 label
),这显然没有意义。你想用 Date
指定什么?
ui=fluidPage(
uiOutput("plot_date_page1"),
)
server=function(input,output,session){
output$plot_date_page1<-renderUI({
sliderInput("plot_date_page1",
# step = "Date",
label = h5("Select mapping date"),
min = as.Date("1980-01-01","%Y-%m-%d"),
max = as.Date("2020-01-01","%Y-%m-%d"),
value = as.Date("2020-01-01"),
timeFormat = "%y %b")
})
}
shinyApp(ui = ui, server = server)