[R-sig-Geo] Creating Regions With a Dummy Variable Identifier

Roger Bivand Roger.Bivand at nhh.no
Fri Jan 21 08:11:20 CET 2011


On Thu, 20 Jan 2011, Matthew Hasbrouck wrote:

>
> Hello everyone,
>
> I am a graduate student currently working with census tract data. I have 
> identified census tracts as either having a certain characteristic or 
> not, using a dummy variable. This variable is coded as 1 if the tract 
> has that characteristic and 0 if it doesn't. I would like to take all 
> contiguous tracts coded as 1 and dissolve them into single records. What 
> would be left are all of the original tracts that do not have this 
> characteristic, coded as 0, and records for the larger dissolved areas 
> that contained this characteristic. I originally thought the SKATER 
> function might work, but I don't think it will work properly with a 
> dummy variable.

Please see ?unionSpatialPolygons in maptools. You'll need to construct a 
new set of ID values, with your tracts to be dissolved having the same ID, 
and all the others having their own different IDs. Note the warning about 
the license of gpclib in case you are affected.

Roger

>
> Thanks,
> Matt
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list