map guide - ryan t. moore9/12/2017 map guide file://localhost/users/tessharkin/mapguide.html 2/4...

4
9/12/2017 Map Guide file://localhost/Users/tessharkin/mapguide.html 1/4 Map Guide Tess Harkin 2017-09-12 #load the data you will be mapping with grocery_stores <- read.csv("Downloads/Grocery_Store_Locations.csv") install.packages("ggmap", repos = "https://cran.r-project.org/web/packages/ggmap/index.h tml" ) # install ggmap package ## Warning: unable to access index for repository https://cran.r-project.org/web/package s/ggmap/index.html/src/contrib: ## cannot download all files ## Warning: package 'ggmap' is not available (for R version 3.3.2) ## Warning: unable to access index for repository https://cran.r-project.org/web/package s/ggmap/index.html/bin/macosx/mavericks/contrib/3.3: ## cannot download all files library("ggmap") # load ggmap ## Loading required package: ggplot2 grocery_stores.map <- get_map("Washington, DC", zoom = 12) ## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=Washington,+DC&zo om=12&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false ## Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=Washi ngton,%20DC&sensor=false ggmap(grocery_stores.map) # this will create a map of Washington, DC

Upload: others

Post on 10-Feb-2021

3 views

Category:

Documents


0 download

TRANSCRIPT

  • 9/12/2017 Map Guide

    file://localhost/Users/tessharkin/mapguide.html 1/4

    Map GuideTess Harkin2017-09-12

    #load the data you will be mapping with grocery_stores

  • 9/12/2017 Map Guide

    file://localhost/Users/tessharkin/mapguide.html 2/4

    #This is how you plot points on the map. aes() determines what points you are plotting. You can look at your data to see how lat/lon are labeled. ggmap(grocery_stores.map) + geom_point(data = grocery_stores, aes(X, Y), size = 1)

  • 9/12/2017 Map Guide

    file://localhost/Users/tessharkin/mapguide.html 3/4

    #You can change the color of the points. To change the style of the points or the size, add that after aes(). ggmap(grocery_stores.map) + geom_point(data = grocery_stores, aes(X, Y, col = WARD), pch = 22, size = 3)

  • 9/12/2017 Map Guide

    file://localhost/Users/tessharkin/mapguide.html 4/4