[R-sig-Geo] subs (raster) on large dataset

Robert Hijmans r.hijmans at gmail.com
Thu Apr 14 19:43:52 CEST 2011


I have no idea what might be causing this. I would suggest to track down
where exactly this happens, by going, line by line, through the code of

getMethod("subs", c("RasterLayer", "data.frame"))

Presumably, something is not moving here:

for (i in 1:tr$n) {
     v <- getValues(x, row = tr$row[i], nrows = tr$size)
     r <- writeValues(r, localmerge(v, y, subsWithNA),  tr$row[i])

so you can try

 i <- 1
 v <- getValues(x, row = tr$row[i], nrows = tr$size)
 x <- localmerge(v, y, subsWithNA)

and if that last step is indeed very slow, have a step by step look at

You can then also see of it matters if you make changes to the "chunksize"
and "maxmemory" options ?setOptions. These will affect the size of "v" in
the code above, and perhaps there is a non-linear effect on the performance
of merge. 


View this message in context: http://r-sig-geo.2731867.n2.nabble.com/subs-raster-on-large-dataset-tp6272926p6273741.html
Sent from the R-sig-geo mailing list archive at Nabble.com.

More information about the R-sig-Geo mailing list