sidebarLayout参数

时间:2019-02-19 09:44:53

标签: r shiny arguments

我在sidebarLayout中遇到以下错误:以下脚本缺少参数“ mainPanel”,没有默认值:

library(shiny)
shinyUI(fluidPage(
titlePanel(title = "Pig breeding trends by country"),
sidebarLayout(
      sidebarPanel(
             mainPanel("2000 to 2010"),
             sliderInput(inputId = "year",
                         label = "year by year count:",
                         min = 2000, max = 2010,
                         value = 1)
                        )
                )
       )
)

我检查了其他线程,这似乎是因为mainPanel不在sidebarLayout中,但是我已经检查了它,并将其放在方括号中,现在不确定该怎么做。

1 个答案:

答案 0 :(得分:0)

这将起作用:

shinyUI(
  fluidPage(
    titlePanel(title = "Pig breeding trends by country"), 
    sidebarLayout(
      sidebarPanel(
        sliderInput(inputId = "year", 
                    label = "year by year count:", 
                    min = 2000, 
                    max = 2010, 
                    value = 1) ),
      mainPanel())))