Following thread re: subsetting a SpatialPointsDataFrame. Poking around and
found some unexpected behavior with a SpatialPolygonsDataFrame. The subset
argument appears to be interpreted as select. That is:

subsetPolygons = subset(somePolygons, somePolygons$someColumn ==
subsetCriteria)

returns all rows (all polygons), but the dataframe in the data slot only
has columns selected by the logical vector spdfThis$someColumn ==
"something". This of course is the behavior expected if I specified the
select argument instead of the subset argument. I tried this explicitly
naming the subset argument (subset = ...), rather than implicitly, and
observed the same behavior.

Doing the same thing with a SpatialPointsDataFrame appears to work as
expected.

Not uploading my data, but the actual code I ran, so you can scan it for
stupid errors is:

#Using SpatialPolygonsDataFrame
#Produces map of New York City with only Manhattan
plot(spdfBoro[spdfBoro$boro_code == 1,])

#Produces map of New York City with five boros, every fifth column appears
in data frame
plot(subset(spdfBoro, spdfBoro$boro_code == 1))

#Using SpatialPointsDataFrame
#Produces map of point locations in New York City, only those points in
Manhattan
plot(sndfWf1[sndfWf1$borough == "New York",])

#Produces map of point locations in New York City, only those points in
Manhattan
plot(subset(sndfWf1, sndfWf1$borough == "New York"))

Am I doing something wrong?

Regards,
--Lee

-- 
Lee Hachadoorian
PhD, Earth & Environmental Sciences (Geography)
Research Associate, CUNY Center for Urban Research
http://freecity.commons.gc.cuny.edu/

	[[alternative HTML version deleted]]

