Created
November 16, 2017 12:27
-
-
Save mrchypark/383e100b3b6e9569a8f0325ad0300ba3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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(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