Everything works until I try to assign pmin to a new column; at which point I get the error "replacement has 0 rows, data has 70." If I take out the line where I marked "#here", I would get two tabs of interactive ShinyApp tables. What do I do? Is this a ShinyApp problem or dataframe or did I do anything that I should not have done?
ui <- fluidPage(
navbarPage("Limits",
tabPanel("Berlin",
sidebarPanel(
# Layout
width = 3,
# Input: Simple integer interval ----
numericInput("a_b", "A.ratio1:",0.05)
), # sidebarPanel
mainPanel(
width = 9,
# Output: Table summarizing the values entered ----
tabPanel("Berlin", tableOutput("data_Berlin"))
) # mainPanel
), # Berlin, tabPanel
tabPanel("China",
sidebarPanel(
# Layout
width = 3,
# Input: Simple integer interval ----
numericInput("a_c", "A.ratio1:",0.05)
), # sidebarPanel
mainPanel(
width = 9,
# Output: Table summarizing the values entered ----
tabPanel("China", tableOutput("data_China"))
) # mainPanel
) # China, tabPanel
) # navbarPage
) # fluid page
server <- function(input, output) {
output$data_Berlin <- renderTable({
# Process
berlin_table$MAX <- berlin_table$avg*input$a_b
berlin_table
}, bordered=TRUE, digits=5)
output$data_China <- renderTable({
# Process
china_table$MIN <- pmin(china_table$lim,input$a_c) #here
china_table
}, bordered=TRUE, digits=5)
}
shinyApp(ui, server)