 # Stats 449 hw0.pdf - install.packages c ggplot2 devtools...

• 2

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 1 - 2 out of 2 pages.

install.packages(c("ggplot2", "devtools", "dplyr", "stringr"))install.packages(c("maps", "mapdata","ggmap"))library(ggplot2)library(ggmap)library(maps)library(mapdata)usa <- map_data("usa")dim(usa)head(usa)#Problem 1: Make a map of the USA and add points for Los Angeles and New York City.usa <- map_data("usa")ggplot() + geom_polygon(data = usa, aes(x=long, y = lat, group = group)) +coord_fixed(1.3)ggplot() +geom_polygon(data = usa, aes(x=long, y = lat, group = group),fill = NA, color = "red") +coord_fixed(1.3)gg1 <- ggplot() +geom_polygon(data = usa, aes(x=long, y = lat, group = group),fill = "yellow", color = "blue") +coord_fixed(1.3)gg1labs <- data.frame(long = c(-118.243683, -73.935242),lat = c(34.052235, 40.7306107),names = c("Los Angeles", "New York City"),stringsAsFactors = FALSE)gg1 +geom_point(data = labs, aes(x = long, y = lat), color = "black", size = 3)#Problem 2states <- map_data("state")dim(states)head(states)tail(states)mi_df <- subset(states, region == "michigan")head(mi_df)counties <- map_data("county")
End of preview. Want to read all 2 pages?

Course Hero member to access this document

Term
Fall
Professor
greenpaul
Tags
• • • 