Created
February 24, 2018 07:45
-
-
Save cecilialee/b5c14e1d5629307f6cc52d9440b96bd6 to your computer and use it in GitHub Desktop.
Tabset panel in Shiny. #r #shiny
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(dplyr) | |
library(ggplot2) | |
ui = fluidPage( | |
tabsetPanel( | |
tabPanel("Plot", | |
plotOutput("my_plot") | |
), | |
tabPanel("Data", | |
dataTableOutput("my_table") | |
) | |
) | |
) | |
server = function(input, output) { | |
output$my_plot <- renderPlot({ | |
mtcars %>% ggplot() + geom_point(aes(x = mpg, y = drat, color = cyl)) | |
}) | |
output$my_table <- renderDataTable({ | |
mtcars | |
}) | |
} | |
shinyApp(ui, server) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment