Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions exercise-3/server.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# server.R
library(dplyr)
library(shiny)
library(plotly)

# Read in data
setwd('~/Documents/info-201/m14-shiny/exercise-3/')
Expand All @@ -18,6 +20,6 @@ shinyServer(function(input, output) {

# Render a plotly object that returns your map
output$map <- renderPlotly({
return(BuildMap(joined.data, input$mapvar))
return(BuildMap(joined.data, 'population'))
})
})
})
6 changes: 4 additions & 2 deletions exercise-3/ui.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# ui.R
library(shiny)
library(plotly)

shinyUI(fluidPage(
mainPanel(
# Add a selectInput (with a proper id) that allows you to select a variable to map
selectInput('mapvar', label = 'Variable to Map', choices = list("Population" = 'population', 'Electoral Votes' = 'votes', 'Votes / Population' = 'ratio')),

# Use plotlyOutput to show your map
plotlyOutput('map')
)
))
))