Skip to content
Prev 9964 / 29559 Next

problem with adding data to spatialpolygonsdataframe

On Fri, Nov 12, 2010 at 11:27 AM, Franziska Schulze
<franziska.schulze at wiwi.hu-berlin.de> wrote:
You can for the most part treat it like a data frame. For example,
using the spdf created in help("SpatialPolygonsDataFrame-class")
Object of class SpatialPolygonsDataFrame
Coordinates:
  min  max
x 0.5 10.5
y 0.5 10.5
Is projected: NA
proj4string : [NA]
Data attributes:
       x              y              z
 Min.   : 1.0   Min.   : 1.0   Min.   :1.702
 1st Qu.: 3.0   1st Qu.: 3.0   1st Qu.:2.626
 Median : 5.5   Median : 5.5   Median :3.123
 Mean   : 5.5   Mean   : 5.5   Mean   :3.127
 3rd Qu.: 8.0   3rd Qu.: 8.0   3rd Qu.:3.614
 Max.   :10.0   Max.   :10.0   Max.   :4.600
Object of class SpatialPolygonsDataFrame
Coordinates:
  min  max
x 0.5 10.5
y 0.5 10.5
Is projected: NA
proj4string : [NA]
Data attributes:
       x              y              z              FOO
 Min.   : 1.0   Min.   : 1.0   Min.   :1.702   Min.   :99
 1st Qu.: 3.0   1st Qu.: 3.0   1st Qu.:2.626   1st Qu.:99
 Median : 5.5   Median : 5.5   Median :3.123   Median :99
 Mean   : 5.5   Mean   : 5.5   Mean   :3.127   Mean   :99
 3rd Qu.: 8.0   3rd Qu.: 8.0   3rd Qu.:3.614   3rd Qu.:99
 Max.   :10.0   Max.   :10.0   Max.   :4.600   Max.   :99
The dimension will change because you are adding a new column - if the
number of rows have changed then something is going wrong...

Post some code?

Barry