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

时间:2019-01-02 20:34:41

标签: r shiny

我正在开发R Shiny应用程序,但似乎遇到以下错误:

  

sidebarLayout(sidebarPanel(selectInput(inputId =“ App”,label =“ Application:”,:     参数“ mainPanel”丢失,没有默认值

我玩过')'和','但没有用。我希望能有新的眼光来迅速突出代码中的错误。

library(shiny)
library(ggplot2)
library(stringr)
library(dplyr)
library(DT)
library(tools)
library(lubridate)
library(data.table)

dtCLIPKey <- as.data.frame(updated_dtCLIPKey_11_16)

min_date <- min(dtCLIPKey$Date_1)
max_date <- max(dtCLIPKey$Date_1)

dtCLIPKey <- as.data.table(dtCLIPKey)


dtCLIPKey[,Short.NameN := .N,by="Short.Name"]

#NEED TO REMEMBER TO GET COUNT RIGHT TO INCLUDE HOURS AND DAY LIMITATION

dtCLIPKey$Short.NameRank <-frankv(dtCLIPKey$Short.NameN, ties.method = "dense")

# Define UI for application that plots features of movies
ui <- navbarPage("Aggregate Applications")



# App title
titlePanel("JRSS Application Analysis", windowTitle = "Latency Trend")

# Sidebar layout with a input and output definitions
sidebarLayout(

  # Inputs
  sidebarPanel(

    wellPanel(
      h3("Plotting"),      # Third level header: Plotting

    # Explanatory text
    HTML(paste0("Trend will be based on traffic samples from the following date selection. 
                Pick dates between ", min_date, " and ", max_date, ".")),

    # Break for visual separation
    br(), br(),

    # Date input
    dateRangeInput(inputId = "date",
                   label = "Select dates:",
                   start = "2018-09-01", end = "2018-10-31",
                   min = min_date, max = max_date,
                   startview = 'year') #SHOWS CURRENT YEAR!!
    ),


  # Select variable for x-axis
  selectInput(inputId = "hours", 
              label = "Hour:",
              choices = levels(factor(unique(dtCLIPKey$Hour_1))), 
              selected = "1"),

  #Number of Applications 
  sliderInput("freq",
              "Top N Applications:",
              min = 1,  max = 40, value = 10),

  wellPanel(
    # Show data table
    checkboxInput(inputId = "show_data",
                  label = "Show data table",
                  value = TRUE)
  ),

  # Built with Shiny by RStudio
  br(), br(),
  h5("Built with",
     img(src = "https://www.rstudio.com/wp-content/uploads/2014/04/shiny.png", height = "30px"),
     "by",
     img(src = "https://www.rstudio.com/wp-content/uploads/2014/07/RStudio-Logo-Blue-Gray.png", height = "30px"),
     ".")

),

# Output:
mainPanel(

  tabsetPanel(type = "tabs",
              # Tab 1: Barchart
              tabPanel(title = "Barchart", 
                       plotOutput(outputId = "barchart"),
                       br(),
                       h5(textOutput("description")),
                       br(),
                       plotOutput(outputId = "boxplot")
              ),

              # Tab 2: ScatterPlot
              tabPanel(title = "ScatterPlot", 
                       plotOutput(outputId = "scatterplot")
              ),


              # Tab 3: Data
              tabPanel(title = "Data", 
                       br(),
                       DT::dataTableOutput(outputId = "traffictable")),


navbarPage("Single Application",  
# App title
titlePanel("JRSS Application Analysis", windowTitle = "Latency Trend"),

# Sidebar layout with a input and output definitions
sidebarLayout(

  # Inputs
  sidebarPanel(

    # Select Application for 
    selectInput(inputId = "App", 
                label = "Application:",
                choices = levels(factor(unique(dtCLIPKey$Short.Name))),
                selected = "XXXX_YYYY"),

    # Date input
    dateRangeInput(inputId = "date2",
                  label = "Select dates:",
                  start = "2018-09-01", end = "2018-10-31",
                  min = min_date, max = max_date,
                  startview = 'year') 
  )
),
          mainPanel(

            tabsetPanel(type = "tabs",
                  # Tab 1: Linechart
                  tabPanel(title = "Linechart", 
                           plotOutput(outputId = "linechart")
                           )
                  )
            )
          )
        )
      )
    )

0 个答案:

没有答案