[R] Coloring Canada provinces (package maps?)

Dimitri Liakhovitski dimitri.liakhovitski at gmail.com
Wed Jan 25 22:25:30 CET 2012


Dear R'ers,

I am wondering what is the smallest geographicterritorial unit
available for formatting in Canada. Provinces?


I know that in the US it is the county so that I can color US
counties any way I want, for example:

### Example for coloring US counties
### Creating an ARTIFICIAL criterion for coloring US counties:
library(maps)
allcounties<-data.frame(county=map('county', plot=FALSE)$names)
allcounties$group<-c(rep(1:6,513),rep(1,4))[order(c(rep(1:6,513),rep(1,4)))]
### My colors:
mycolors <- rainbow(6)
map('county',fill=TRUE,col=mycolors[allcounties$group],resolution=0,lty=0,bg
= "transparent")
map('state', lwd=1, add=TRUE)

I would like to do something similar for Canada. I see that maps knows
Canadian cities:

map("world", "Canada")
map.cities(country = "Canada",Capitals = 2)

But how could I access and map Canada's provinces?
Or maybe there are some even smaller territorial units in Canada (like
counties in the US)? If yes, then in what package are they accessible?

Thanks a lot!

-- 
Dimitri Liakhovitski
marketfusionanalytics.com



More information about the R-help mailing list