以下是我的闪亮应用的代码:
shinyUI(navbarPage("My Application",id="main",
tabPanel
(
"Select Data range",
sidebarLayout
(
sidebarPanel
(
selectInput("select_sector", label = h3("Select Sector"),choices = list("Sector 1" = 1, "Sector 2" = 2,"Sector 3" = 3), selected = 1),br(),
dateRangeInput("dates_range_input", label = h3("Select Date range")),br(),
actionButton("action_proceed1", label = "Proceed to select resolution")
),
mainPanel(tableOutput("first"))
)
),
tabPanel
(
"Select Resolution",
sidebarLayout
(
sidebarPanel
(
numericInput("XGRID", label = h3("Select X-Grid Size"), value = 2),br(),
numericInput("YGRID", label = h3("Select Y-Grid Size"), value = 2),br(),
numericInput("outlier_removal", label = h3("Outlier Removal"), value = 2),br(),
numericInput("frequency", label = h3("Frequency"), value = 2),br(),
actionButton("action_proceed2", label = "Proceed to Service Parameters")
),
mainPanel("Here will be the image for marketing purpose")
)
)
))
shinyServer(function(input, output,session) {
output$first <- renderTable
({
data.frame(x=1:100,y=1:100)
})
observe({
if (input$action_proceed1>0) {
updateTabsetPanel(session, "main", selected = "Select Resolution")
}
})
})
我期待输出作为定义的数据帧但收到意外错误:
argument "expr_sub" is missing, with no default
请在这里建议我做错了什么。我打算使用输入变量放置一个数据集,但接收到相同的错误,这就是为什么为了简单起见我替换了数据框。
答案 0 :(得分:1)
对于将argument "expr_sub" is missing, with no default
视为错误消息的其他用户,可能会有用。该错误表明您的renderTable
后面有换行符。目前为output$first
分配了函数renderTable,而不是使用后面的表达式中提供的内容来评估函数。
output$first <- renderTable
({
data.frame(x=1:100,y=1:100)
})
应该是:
output$first <- renderTable({
data.frame(x=1:100,y=1:100)
})
因为它代表R只是在两个块中解释代码,将函数赋值给output$first
,然后是一段代码。