Skip to content

Instantly share code, notes, and snippets.

@cecilialee
Created February 24, 2018 07:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cecilialee/b5c14e1d5629307f6cc52d9440b96bd6 to your computer and use it in GitHub Desktop.
Save cecilialee/b5c14e1d5629307f6cc52d9440b96bd6 to your computer and use it in GitHub Desktop.
Tabset panel in Shiny. #r #shiny
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