I am trying to run the below Shiny App but I am getting a:
"ERROR: argument "mainPanel" is missing, with no default"
message. Even though I take care of the mainPanel inside the sidebarLayout and outside the sidebarPanel and I tried another relative solutions available on the web, but the error remains the same.
Please help me in finding the error and rectifying it.
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
})
})