[R-sig-Geo] extracting row of data in a SpatialGridDataFrame object
Elena_C
E.Couce at bristol.ac.uk
Tue May 29 14:35:58 CEST 2012
Hello all,
I believe my question must be quite basic, but I've spent quite some time
and I haven't managed to figure it out on my own, so any help would be
greatly appreciated.
I have a SpatialGridDataFrame object and I'm trying to extract the
associated data, by both rows and columns, as vectors. Ive managed to get
the columns to work with the operator [[ ]]:
> class(bio_grid)
[1] "SpatialGridDataFrame"
attr(,"package")
[1] "sp"
> dim(bio_grid)
[1] 43200 33
> class(bio_grid[[1]])
[1] "numeric"
> length(bio_grid[[1]])
[1] 43200
Is it possible to do the same with rows instead of columns? I'm not sure
what "bio_grid[1,]" does, but it is not the first row of the data frame:
> dim(bio_grid[1,])
[1] 360 33
I know it is possible to extract the data.frame and work with it normally:
bio_data <- data.frame(bio_grid)
Extract row number 'i': bio_data[i,]
But I was wondering if it could be done directly from the SpatialGrid,
because I have very large objects and my computer takes forever and
sometimes hangs up when I try to extract the data.frame
Thanks a lot,
Elena
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/extracting-row-of-data-in-a-SpatialGridDataFrame-object-tp7579385.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list