Thank you very much, Barry! Dimitri On Thu, Jan 26, 2012 at 12:00 PM, Barry Rowlingson <b.rowling...@lancaster.ac.uk> wrote: > On Thu, Jan 26, 2012 at 4:03 PM, Dimitri Liakhovitski > <dimitri.liakhovit...@gmail.com> wrote: >> Barry, thanks a lot! >> I was able to read in Candian data set from gadm: >> >> library(raster) >> # Finding ISO3 code for Canada >> getData('ISO3') # Canada's code is "CAN" >> # Reading in data at different levels >> can0<-getData('GADM', country="CAN", level=0) >> can1<-getData('GADM', country="CAN", level=1) >> can2<-getData('GADM', country="CAN", level=2) >> class(can0) >> str(can0) >> class(can1) >> str(can1) >> >> Apologies for a novice question (I've never worked with maps and >> raster before): what is the way in raster to see what are the >> geographic units within each data set (can0, can1, can2)? >> And what function allows to plot them and color them? > > These are now SpatialPolygonDataFrame objects - like data frames, but > each row has an associated polygonal geometry. These actually come > from the sp package which the raster package has loaded for you. > > class(can0) will tell you this. > > names(can1) will tell you the names of the attributes of the polygons > which you can use like columns of a data frame. > > plot(can1) will plot it > > spplot(can1, "columnname") will do a coloured plot. > > For more info, check the help for sp or read the R-Spatial Task View > on CRAN which has everything you need to know about maps and such in > R. > > Ask any more questions like this on the R-sig-geo mailing list where > the mapping R people hang out... > > Barry
-- Dimitri Liakhovitski marketfusionanalytics.com ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.