Skip to content

Instantly share code, notes, and snippets.

@Tadge-Analytics
Created July 5, 2020 22:41
Show Gist options
  • Save Tadge-Analytics/1aa8e56b17e2a59f59dac11a24ba090f to your computer and use it in GitHub Desktop.
Save Tadge-Analytics/1aa8e56b17e2a59f59dac11a24ba090f to your computer and use it in GitHub Desktop.
library(shiny)
library(shinydashboard)
library(tidyverse)
library(DT)
ui <- dashboardPage(
dashboardHeader(title = "Header"),
dashboardSidebar(
sidebarMenu(
menuItem(text = "Data", tabName = "data", icon = icon("table")),
menuItem(text = "Plots", tabName = "plots", icon = icon("chart-bar")))),
dashboardBody(
tabItems(
tabItem(tabName = "data",
DTOutput("data1")),
tabItem(tabName = "plots",
plotOutput("plot1"))
)
)
)
server <- function(input, output) {
filteredData <- reactive(mtcars)
output$plot1 <- renderPlot(
filteredData() %>%
ggplot() +
aes_string("wt", "mpg") +
geom_point()
)
output$data1 <- renderDT(
filteredData() %>%
datatable()
)
}
shinyApp(ui = ui, server = server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment