Skip to content

Instantly share code, notes, and snippets.

@senthilthyagarajan
Created May 3, 2018 00:15
Show Gist options
  • Save senthilthyagarajan/50d755c04ad575e4b50c7d229c3c8d63 to your computer and use it in GitHub Desktop.
Save senthilthyagarajan/50d755c04ad575e4b50c7d229c3c8d63 to your computer and use it in GitHub Desktop.
library(shiny)
# Define UI ----
ui <- fluidPage(
titlePanel("censusVis"),
sidebarLayout(
sidebarPanel(
helpText("Create demographic maps with
information from the 2010 US Census."),
selectInput("var",
label = "Choose a variable to display",
choices = list("Percent White",
"Percent Black",
"Percent Hispanic",
"Percent Asian"),
selected = "Percent White"),
sliderInput("range",
label = "Range of interest:",
min = 0, max = 100, value = c(0, 100))
),
mainPanel(
textOutput("selected_var"),
textOutput("min_max")
)
)
)
# Define server logic ----
server <- function(input, output) {
output$selected_var <- renderText({
paste("You have selected this",input$var)
})
output$min_max <- renderText({
paste("You have chosen a range that goes from",
input$range[1], "to", input$range[2])
})
}
# Run the app ----
shinyApp(ui = ui, server = server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment