Created
July 5, 2020 22:41
-
-
Save Tadge-Analytics/1aa8e56b17e2a59f59dac11a24ba090f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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