错误:argument";“主面板”;缺少,没有默认值
我正在尝试运行以下闪亮的应用程序,但我得到了一个: 错误:缺少参数“mainPanel”,没有默认值 信息。尽管我在侧边栏布局内部和侧边栏面板外部处理主面板,并尝试了web上的其他相关解决方案,但错误仍然是一样的 请帮我找出错误并改正错误:argument";“主面板”;缺少,没有默认值,r,shiny,R,Shiny,我正在尝试运行以下闪亮的应用程序,但我得到了一个: 错误:缺少参数“mainPanel”,没有默认值 信息。尽管我在侧边栏布局内部和侧边栏面板外部处理主面板,并尝试了web上的其他相关解决方案,但错误仍然是一样的 请帮我找出错误并改正 library(shiny) shinyUI(pageWithSidebar( titlePanel("Road Accident"), sidebarLayout( sidebarPanel(selectInput('geo', 'Count
library(shiny)
shinyUI(pageWithSidebar(
titlePanel("Road Accident"),
sidebarLayout(
sidebarPanel(selectInput('geo', 'Country', choices = list("Unknown" ="AT","BE","CZ","DE","DK","EL","ES","FI","FR",
"IE","IT","LI","LU","NL","PT","RO","SE","UK","PL","SI","BG","CH","CY",
"EE","HU","IS","LV","MT","NO","SK","HR","LT")
)
),
mainPanel(
plotOutput("newHist"))
)
))
library(shiny)
library(ggplot2)
library(dplyr)
library(eurostat)
p1<-get_eurostat("tsdtr420",time_format="num")
p2<-p1[!rowSums(is.na(p1)),]
shinyServer(
function(input, output) {
output$newHist<- renderPlot({
p3 <- filter(p2, grepl(input$geo,geo))
p<-ggplot(data=p3,aes(time,values))+geom_bar(stat="identity")+theme_bw()+theme(legend.position="none")+
labs(title="Road Accidents",x="",y="Victims")
print(p)
output$geo
})
})
库(闪亮)
shinyUI(带侧栏的页面)(
titlePanel(“道路事故”),
侧边栏布局(
侧边栏面板(选择输入('geo','Country',选项=列表(“未知”=“AT”,“BE”,“CZ”,“DE”,“DK”,“EL”,“ES”,“FI”,“FR”),
“IE”、“IT”、“LI”、“LU”、“NL”、“PT”、“RO”、“SE”、“UK”、“PL”、“SI”、“BG”、“CH”、“CY”,
“EE”、“HU”、“IS”、“LV”、“MT”、“NO”、“SK”、“HR”、“LT”)
)
),
主面板(
绘图输出(“新历史”))
)
))
图书馆(闪亮)
图书馆(GG2)
图书馆(dplyr)
图书馆(欧盟统计局)
p1如果不使用sidebarLayout
,它可以正常工作。您只需使用?pageWithSidebar
、?sidebarLayout
等来检查元素所需的参数pageWithSidebar
需要三个参数,您只给出了两个
shinyUI(pageWithSidebar(
titlePanel("Road Accident"),
sidebarPanel(selectInput('geo', 'Country', choices = list("Unknown" ="AT","BE","CZ","DE","DK","EL","ES","FI","FR",
"IE","IT","LI","LU","NL","PT","RO","SE","UK","PL","SI","BG","CH","CY",
"EE","HU","IS","LV","MT","NO","SK","HR","LT"))),
mainPanel(plotOutput("newHist")))
)