How to map your data
- Download
your data and load it into R
- Load
map libraries:
- library(maps)
- library(maptools)
- Load
the zip code data
- Set
the working directory to where ever the zip code data is
i. File
-> Change Dir
- zip
<- readShapePoly("zt06_d00_shp/zt06_d00")
- You
may want to create a subset of your data that is just the chill or stress
- chill
<- subset(stresschill,stress_value>0)
- How
would you subset for stress?
- How
would you handle “neutral” data (stress_value equals 0)?
- Draw
your map of the county, zip code, etc.
- map('county','california,los
angeles')
- plot(zip[zip$NAME=="90280",])
- Plot
your points on the map
- points(chill$longitude,chill$latitude,col="blue")
- You
can do a similar command to plot the stress in red
- You
can use different characters as the points
i. points(chill$longitude,chill$latitude,pch=20,col="blue")
ii. points(chill$longitude,chill$latitude,pch="'",col="blue")
- Add a
title
- title(“My
Community”)