繁体   English   中英

参数“ mainPanel”丢失,没有默认值

[英]argument “mainPanel” is missing, with no default

我有一个错误问题:

参数“ mainPanel”丢失,没有默认值

我有类似问题的搜索论坛,但我是初学者,所以一些琐碎的事情可能是错误的。

mainPanel也没有丢失,逗号是正确的。 你有什么建议吗?

可以通过以下链接使用csv文件: https : //ufile.io/wknza

请查看代码:

library(shiny)
library(fmsb)
library(ggplot2)

nba2 = read.csv("headerlivingconditionsPos.csv", header = TRUE, sep = ",")
nba = read.csv("livingconditions.csv", header = TRUE, sep = ",")
header = read.csv("headerlivingconditions.csv", header = TRUE, sep = ",")

nbaSelectAttributes = nba2
nbaSelectAttributes$COUNTRIES <- NULL
nbaSelectAttributes$TEAM <- NULL
nba2$X <- NULL
attributes <- attributes(nbaSelectAttributes)$names
countriesName = attributes(nba$COUNTRIES)$levels
teams = attributes(nba$TEAM)$levels

ui <- fluidPage(

  titlePanel("NBA Analysis Application"),

  navlistPanel(
    "Menu",
    tabPanel("COUNTRIES Comparison",
             sidebarLayout(
               sidebarPanel(
                 selectInput("country1", "Choose the first country:",
                             choices = countriesName),
                 selectInput("country2", "Choose the second contry:",
                             choices = countriesName),
                 column(12, 
                        checkboxGroupInput("checkGroup", 
                                           h3("Choose the stats that you want to compare (at least 3):"), 
                                           choices = list("Housing" = "HOUSING", 
                                                          "Income" = "INCOME", 
                                                          "Jobs" = "JOBS",
                                                          "Community" = "COMMUNITY",
                                                          "Education" = "EDUCATION",
                                                          "Environment" = "ENVIRONMENT",
                                                          "Civic Engagement " = "CIVIC ENGAGEMENT",
                                                          "Health   " = "HEALTH ",
                                                          "Life satisfaction" = "LIFE SATISFACTION",
                                                          "Safety" = "SAFETY",
                                                          "Work Life Balance" = "WORK LIFE BALANCE",
                                               selected = "JOBS"))
               ),
               mainPanel(
                 plotOutput("radarChart"),
                 p("Every variable is measured in scale of 0 to 10.")
               )
             )


    ),
    tabPanel("Info",
             fluidRow(
               shiny::column(6, offset = 0, h1("Probando"))

             )
    )
  )
),

server <- function(input, output) {


  output$radarChart <- renderPlot({
    nba$TEAM <- NULL
    pl1 <- subset(nba, COUNTRIES == input$country1)
    pl2 <- subset(nba, COUNTRIES == input$country2)
    merge1 <- rbind(header, pl1)
    merge2 <- rbind(merge1, pl2)
    ###
    datasetInput <- reactive({
      perm.vector <- as.vector(input$checkGroup)
      perm.vector
    }) 

    ###
    final = subset(merge2, select = c(input$checkGroup) )
    final$COUNTRIES <- NULL
    colors_border=c( rgb(0.2,0.5,0.5,0.9), rgb(0.8,0.2,0.5,0.9) , rgb(0.7,0.5,0.1,0.9) )
    colors_in=c( rgb(0.2,0.5,0.5,0.4), rgb(0.8,0.2,0.5,0.4) , rgb(0.7,0.5,0.1,0.4) )
    radarchart( final  , axistype=1 , 
                #custom polygon
                pcol=colors_border , pfcol=colors_in , plwd=4 , plty=1,
                #custom the grid
                cglcol="grey", cglty=1, axislabcol="grey", cglwd=0.8,
                #custom labels
                vlcex=0.8 
    )
    legend(x=1.5, y=1, legend = c(input$COUNTRIES1, input$COUNTRIES2), bty = "n", pch=20 , col=colors_in , text.col = "grey", cex=1.2, pt.cex=3)
    datasetInput
  })

}
)

shinyApp(ui = ui, server = server)

预先感谢您的帮助!

缺少括号,无法在ui中关闭sidebarPanel 修改后的用户界面代码如下:

ui <- fluidPage(
  titlePanel("NBA Analysis Application"),
  navlistPanel(
    "Menu",
    tabPanel("COUNTRIES Comparison",
       sidebarLayout(
           sidebarPanel(
             selectInput("country1", "Choose the first country:",
                         choices = countriesName),
             selectInput("country2", "Choose the second contry:",
                         choices = countriesName),
             column(12, 
                 checkboxGroupInput("checkGroup", 
                    h3("Choose the stats that you want to compare (at least 3):"), 
                    choices = list("Housing" = "HOUSING", 
                                   "Income" = "INCOME", 
                                   "Jobs" = "JOBS",
                                   "Community" = "COMMUNITY",
                                   "Education" = "EDUCATION",
                                   "Environment" = "ENVIRONMENT",
                                   "Civic Engagement " = "CIVIC ENGAGEMENT",
                                   "Health   " = "HEALTH ",
                                   "Life satisfaction" = "LIFE SATISFACTION",
                                   "Safety" = "SAFETY",
                                   "Work Life Balance" = "WORK LIFE BALANCE",
                                   selected = "JOBS"))
                    )
             ),
           mainPanel(
              plotOutput("radarChart"),
              p("Every variable is measured in scale of 0 to 10.")
           )
       )
    ),
    tabPanel("Info",
       fluidRow(
         shiny::column(6, offset = 0, h1("Probando"))
       )
    )
  )
)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM