Re: [R] Generating maps in R

From: Aleksandr Andreev <>
Date: Sun, 30 Mar 2008 19:32:48 -0400

Roger Bivand Roger.Bivand at writes:

> Merge using:
> FS1 <- spCbind(FS, agg2)

This call fails, because:
Error in spCbind(FS, agg2) : different numbers of rows

The reason is because I have data in a001ter for 79 Federal Subjects, but russia.shp contains 193 labeled objects (93 Federal Subjects plus 100 Arctic Ocean Islands and other things). Is there a way I can merge without an equal number of rows, labeling the data for the Arctic islands as missing?


Aleks Andreev
Duke University

2008/3/29, Aleksandr Andreev <>:
> Greetings!
> I am trying plot some data on a map in R. Here's the scenario.
> I have a variable called probworkinghealthy which contains a predicted
> probability of employment for every individual in my sample (about
> 100,000 observations).
> I have another variable, called a001ter, which contains the subject of
> residency in the Russian Federation (akin to a US state) for every
> individual in the sample.
> I have a shape file with the boundaries of all the subjects, called russia.shp.
> I can plot boxplots of the probability by Federal Subject using
> plot(probworkinghealthy ~ a001ter). I can also plot the map using
> plot(russia.shp)
> Now, I would like to plot the mean probability of employment (i.e.
> mean(probworkinghealthy)) on a map of Russia using color coding all
> the Federal Subjects. Does anyone know how to do something like that?
> Much appreciated,
> Aleks Andreev
> Duke University
> mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Sun 30 Mar 2008 - 23:37:19 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 31 Mar 2008 - 13:30:26 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive