Skip to content

Instantly share code, notes, and snippets.

@mrchypark
Created November 16, 2017 12:27
Show Gist options
  • Save mrchypark/383e100b3b6e9569a8f0325ad0300ba3 to your computer and use it in GitHub Desktop.
Save mrchypark/383e100b3b6e9569a8f0325ad0300ba3 to your computer and use it in GitHub Desktop.
library(shiny)
library(ggplot2)
library(gapminder)
library(dplyr)
ui <- fluidPage(
titlePanel("ggplot test"),
sidebarPanel(
checkboxGroupInput("checkGroup"
, label = "Checkbox group",
choices = list("케나다" = "Canada"
, "르완다" = "Rwanda"
, "캄보디아" = "Cambodia"),
selected = "Canada")
),
mainPanel(
plotOutput("ggplot")
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$ggplot <- renderPlot({
jCountries <- input$checkGroup
plot4 <- gapminder %>% filter(country %in% jCountries) %>%
ggplot(aes(x = year, y = lifeExp, color = country)) +
geom_line() + geom_point()
plot4
})
}
# Run the application
shinyApp(ui = ui, server = server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment