r - 缺少参数“mainPanel”,R 闪亮中没有默认值
问题描述
我对 Shiny R 还很陌生!我想我可能缺少括号,但我一直在检查,但找不到错误。抱歉发布这么多代码!但是,如果你们可以检查我可能缺少括号的位置,是否有可能?
ui <- fluidPage(
navbarPage(title = "Demo Bar",
tabPanel("Percent college",
sidebarLayout(
sidebarPanel(
selectInput(inputId = "state", label = "Select a state:",
choices = unique(midwest$state),
selected = "IL",
multiple = TRUE),
hr(),
helpText("Data From Midwest data frame"),
textInput(inputId = "title", label = "Write a title!", value = "Midwest scatter plot comparison"),
),
mainPanel(
plotlyOutput("scatterplot")
),
),
),
tabPanel("Data Page",
sidebarLayout(
sidebarPanel(
sliderInput(
inputId = "area_choice",
label = "Range of Area",
min = area_range[1],
max = area_range[2],
value = area_range
),
mainPanel(
plotOutput("plot")
),
),
),
),
),
)
解决方案
- 正如斯蒂芬所评论的那样,你
mainPanel
放错地方了 - 您有几个逗号没有进一步输入,这在 R 中可能会出现问题
另请注意,我必须添加area_range
和library
调用。您的示例无法直接重现
library(shiny)
library(plotly)
area_range <- c(1,2)
ui <- fluidPage(
navbarPage(title = "Demo Bar",
tabPanel("Percent college",
sidebarLayout(
sidebarPanel(
selectInput(inputId = "state", label = "Select a state:",
choices = unique(midwest$state),
selected = "IL",
multiple = TRUE),
hr(),
helpText("Data From Midwest data frame"),
textInput(inputId = "title", label = "Write a title!", value = "Midwest scatter plot comparison"),
),
mainPanel(
plotlyOutput("scatterplot")
)
)
),
tabPanel("Data Page",
sidebarLayout(
sidebarPanel(
sliderInput(
inputId = "area_choice",
label = "Range of Area",
min = area_range[1],
max = area_range[2],
value = area_range
),
),
mainPanel(
plotOutput("plot")
)
)
)
)
)
shinyApp(ui, function(input, output) {})
推荐阅读
- spring - REST API - 如何创建新的数据类型以简化输入验证
- javascript - 如何在我的选项测验中确定分数?
- reactjs - 在material-ui\core\Slider中点击获取值
- laravel - 带有 Laravel 8 的简单上传适配器插件 CKEditor 5
- php - 如何从php中的数组中删除部分值
- python - 从 Python 中的类返回列表或其他数据结构
- c++ - C++ 事件系统设置
- powerbi - Power Bi REST API -> 网关 -> 添加具有 ReadOverrideEffectiveIdentity 访问权限的数据源用户
- python - 解析 Asynchronous Amazon Transcribe Streaming SDK for Python 返回的说话者标签
- imageview - 在Android中使用加速度计时ImageView图像走出屏幕