# NOT RUN {
if(interactive()){
library(shiny)
library(bs4Dash)
shiny::shinyApp(
ui = bs4DashPage(
enable_preloader = TRUE,
navbar = bs4DashNavbar(),
sidebar = bs4DashSidebar(),
controlbar = bs4DashControlbar(),
footer = bs4DashFooter(),
title = "test",
body = bs4DashBody()
),
server = function(input, output) {}
)
}
if(interactive()){
library(shiny)
library(bs4Dash)
shiny::shinyApp(
ui = dashboardPage(
navbar = dashboardHeader(),
sidebar = dashboardSidebar(),
body = dashboardBody(
fluidRow(
column(width = 4, plotOutput("distPlot")),
column(width = 4, tableOutput("data")),
column(width = 4, textOutput("result"))
)
),
controlbar = dashboardControlbar(
skin = "light",
tabsetPanel(
type = "tabs",
id = "tabsetpanel",
tabPanel(
title = "Tab 1",
br(),
sliderInput(
"obs",
"Number of observations:",
min = 0,
max = 1000,
value = 500
)
),
tabPanel(
title = "Tab 2",
br(),
checkboxGroupInput(
"variable",
"Variables to show:",
c("Cylinders" = "cyl",
"Transmission" = "am",
"Gears" = "gear")
)
),
tabPanel(
title = "Tab 3",
br(),
selectInput(
"state",
"Choose a state:",
list(`East Coast` = list("NY", "NJ", "CT"),
`West Coast` = list("WA", "OR", "CA"),
`Midwest` = list("MN", "WI", "IA")
)
)
)
)
)
),
server = function(input, output) {
output$distPlot <- renderPlot({
hist(rnorm(input$obs))
})
output$data <- renderTable({
head(mtcars[, c("mpg", input$variable), drop = FALSE])
}, rownames = TRUE)
output$result <- renderText({
paste("You chose", input$state)
})
}
)
}
# }
Run the code above in your browser using DataLab