My research question is the effect of population density exposure on the risk for MS. In a study from Kaiser Permanente Northern California, we have obtained the residential history for all subjects. Age 10 is a highly susceptible age because the child is rapidly developing and growing as he or she enters puberty.
Most mapping techniques only allow one dimension of information, which is the location on map. I wanted to create a map that can convey another dimension of information that is of interest without over-complicating the visual. The visual mapping functions in R allow me to present the data in a way that is simple but conveys more information than a simple plot.
I have used the maps and mapdata packages in R to first map my location of interest, in this case the continental United States.
library(maps)
map1 <- map("state")
There are many other options in the maps library, and I do have some observations that are outside the continental United States. For this demonstration I will stick to this map.
latlong10 <- read.csv("C:/Users/Allie/Documents/MPH Fall 2013/PH 251D/RProj/Age10_coord_popdens1.csv",
header = T)
library(maps)
library(mapdata)
mapstates <- map("state", xlim = c(-130, -60), ylim = c(20, 50))
rbPal <- colorRampPalette(c("yellow", "red"))
latlong10$col <- rbPal(10)[as.numeric(cut(log(latlong10$popdens_age10), breaks = 10))]
points(x = latlong10$longitude, y = latlong10$latitude, col = latlong10$col,
pch = 19)