I just went through this (with Dr. Roger Bivand's help). You will find the route I used (code is messy!) to arrange my data using R instead of ArcView. Juat replace files names. It took me about a good week to get to this :-)

#_________________________________________________________________________________________________

library(maptools)
library(spgpc)
#aggregate polys
nc_1 <- readShapePoly("ASTAE1.SHP") # put shapefile in SpatialPolygonsDataFrame
summary(nc_1)
nc_1aggregated=unionSpatialPolygons(nc_1, nc_1$MSACMSA)#if more than one polygon for same code
nms=getSpPPolygonsIDSlots(nc_1aggregated)
summary(nms)
outshp=SpatialPolygonsDataFrame(nc_1aggregated, data=data.frame(nms, row.names=nms))
writePolyShape(outshp, fn="outshp")#save shapefile

#merge data to polys
nc_1 <- readShapePoly("outshp.SHP", ID="nms") # put shapefile in SpatialPolygonsDataFrame
nc_2 <- nc_1[nc_1$NAME !="Honolulu, HI",] # subset with "[" method
summary(nc_2)
dat=data.frame(read.delim(file="all.txt", header = TRUE, sep = "\t", quote="\"", dec=".",na.strings = "NA"))#data in "tab delimited" text file
summary(dat)
nc_2$nms=as.numeric(paste(nc_2$nms))# make the two columns look alike, for merging the data
nc_df2 <- merge(as(nc_2, "data.frame"), dat, by.x="nms",by.y="cod", all.x=TRUE, sort=FALSE)#append data to polygons
summary(nc_df2)
row.names(nc_df2)=nc_df2$SP_ID
nc_3 <- SpatialPolygonsDataFrame(as(nc_2, "SpatialPolygons"), data=nc_df2)
writePolyShape(nc_3, "nc_3")
#__________________________________________________________________________________________________


hth,
 

Mihai Nica
170 East Griffith St. G5
Jackson, MS 39201
601-914-0361

----- Original Message ----
From: "matt.pettis@thomson.com" <matt.pettis@thomson.com>
To: r-sig-geo@stat.math.ethz.ch
Sent: Monday, October 16, 2006 1:27:01 PM
Subject: [R-sig-Geo] Plotting a shapefile

Hi,
 
I am trying to read in a shapefile, which is a state map broken into
voting precints, and plot a map of the result.  There is no measure data
as of yet -- only the shapefile with boundaries.  Can anybody give me
direction on how to start this very basic task?
 
thanks,
Matt

    [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo







	[[alternative HTML version deleted]]


