2017-09-22 6 views
0

と私は光沢のあるアプリケーションの下に実行しようとしていますが、私は取得しています:エラー:引数「mainPanelが」失われ、既定値はありません

"ERROR: argument "mainPanel" is missing, with no default"

メッセージを。 sidebarLayoutの内側とsidebarPanelの外側でmainPanelを処理しても、Web上で使用可能な別の解決策を試しましたが、エラーは同じです。

エラーを見つけて修正するのを手伝ってください。

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 
    }) 
    }) 

答えて

0

sidebarLayoutを指定しないと、正常に動作します。 ?pageWithSidebar?sidebarLayoutなどの要素の必要な引数を確認する必要があります。pageWithSidebarは3つの引数を必要とし、2つしか与えませんでした。

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"))) 
) 
関連する問題