[R-sig-Geo] SpatialGridDataFrame to data.frame

Ned Horning horning at amnh.org
Wed Feb 11 07:40:58 CET 2009


Greetings,

I am trying to read an image from GRASS using the spgrass6 command 
readRAST6 and then convert it into a data.frame object so I can use it 
with randomForest. The byte image I'm reading is 2732 rows x 3058 
columns x 3 bands. It's a small subset of a larger image I would like to 
use eventually. I have no problem reading the image using readRAST6 but 
when I try to convert it to a data.frame object my linux system 
resources (1BG RAM, 3GB swap) nearly get maxed out and it runs for a 
couple hours before I kill the process. The image is less than 25MB so 
I'm surprised it requires this level of memory. Can someone let me know 
why this is. Should I use something other than the GRASS interface for 
this? These are the commands I'm using:

spot <- readRAST6(c(“subset.red”, “subset.green”, “subset.blue”))
spot_frame <- as(spot, “data.frame”)

Any help would be appreciated.

All the best,

Ned



More information about the R-sig-Geo mailing list