Wellintton Perez
11/20/2019
This presentation I have included a map of the USA showing the distributions of students participating in Classroom, Inc.
library(plotly)
data<-fread("dateset-latlon.csv",sep=",",stringsAsFactors = FALSE,nrows=-1)
top_5_states <- data[order(-data$count)][1:5]
labels <- c(paste(top_5_states$state,top_5_states$count,sep=": "))
state_count <- data.frame(state = state.abb[match(data$state,state.name)], count = as.vector(data$count))
state_count$hover <- with(state_count, paste(state, '<br>', "Students:", count))
borders <- list(color = toRGB("red"))
map_options <- list(
scope = 'usa',
projection = list(type = 'state usa'),
showlakes = TRUE,
lakecolor = toRGB('white'))
gg<-plot_ly(z = ~state_count$count, text = ~state_count$hover, locations = ~state_count$state,
type = 'choropleth', locationmode = 'USA-states',
color = state_count$count, colors = 'Blues', marker = list(line = borders)) %>%
layout(title = 'Classroom, Inc. Students', geo = map_options)
The map shows the states where Classroom, Inc has affiliated with local schools to allow students to play the games.
Error in file(con, "rb") : cannot open the connection