[英]Shiny Error : Warning: Error in seq.int: 'to' must be a finite number
I am new to Shiny and I am not sure why I get an error.我是 Shiny 的新手,我不确定为什么会出现错误。
I already have created a function that takes an input a variable "name" and then after some lines I simply end by print(plot 1) print(plot 2).我已经创建了一个 function,它接受一个变量“名称”的输入,然后在一些行之后,我简单地以 print(plot 1) print(plot 2) 结束。 Now I want to make this function reactive using shiny.
现在我想使用 shiny 使这个 function 具有反应性。
I have already in my R session environment run the dataframe & the function.我已经在我的 R session 环境中运行 dataframe 和 ZC1C425268E68394F1C14 Then I run the shiny app using this code but I get this error.
然后我使用此代码运行 shiny 应用程序,但出现此错误。 Do you have any idea what could be the issue?
你知道可能是什么问题吗? :/
:/
Warning: Error in seq.int: 'to' must be a finite number警告:seq.int 中的错误:'to' 必须是有限数
library(shiny)
ui <- fluidPage(
headerPanel("Change graph"),
sidebarPanel(
selectInput(
"playlist", "Select a Playlist Name", playlist_names)
),
mainPanel(plotOutput("plot1"))
)
server <- function(input, output) {
output$plot1<-renderPlot({playlist_name_plots("input$playlist")})
}
shinyApp(ui = ui, server = server)
You need to specify what's in playlist_names
passed as choices =
, quoted from ?selectinput
:您需要指定作为
choices =
传递的playlist_names
中的内容,引用自?selectinput
:
List of values to select from.
select 的值列表来自。 If elements of the list are named, then that name — rather than the value — is displayed to the user.
如果列表的元素被命名,那么该名称——而不是值——将显示给用户。 It's also possible to group related inputs by providing a named list whose elements are (either named or unnamed) lists, vectors, or factors.
还可以通过提供一个命名列表来对相关输入进行分组,该列表的元素是(命名或未命名)列表、向量或因子。 In this case, the outermost names will be used as the group labels (leveraging the HTML tag) for the elements in the respective sublist.
在这种情况下,最外面的名称将用作相应子列表中元素的组标签(利用 HTML 标记)。 See the example section for a small demo of this feature.
有关此功能的小演示,请参阅示例部分。
Working example:工作示例:
library(shiny)
playlist_names <- c("Playlist A","Playlist B","Playlist C")
ui <- fluidPage(
headerPanel("Change graph"),
sidebarPanel(
selectInput(
"playlist", "Select a Playlist Name", playlist_names)
),
mainPanel(plotOutput("plot1"))
)
server <- function(input, output) {
output$plot1<-renderPlot({playlist_name_plots(input$playlist)})
}
shinyApp(ui = ui, server = server)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.