[R-sig-Geo] Problems with SpatialPixelsDataFrame objects

Pedro Perez perep1972 at gmail.com
Sat Nov 19 23:50:41 CET 2016


Hi everybody,

The following two scripts will generate a "SpatialPixelDataFrame" object:

# FIRST
library(rgdal)
elev.grid <- readGDAL("whatever.asc")
elev.grid <- as(elev.grid, "SpatialPixelsDataFrame")

# SECOND
library(raster)
library(SDMTools)
library(adehabitat)
elev.grid <- raster("whatever.asc")
elev.grid.asc <- asc.from.raster(elev.grid)
elev.grid.SPDF <- asc2spixdf(elev.grid.asc)


HOWEVER, the first one excedes the capability of my computing
resources when applying it to big (15000 x 16000) grids, and the
second one generates an object which I can't use for some further
analyses. For example, when I use it for krige purposes

x <- krige(V3~var, points, elev.grid)

I get the following:

Error in model.frame.default(terms(formula), as(data, "data.frame"),
na.action = na.fail) :
  invalid type (closure) for variable 'var'

I will be really thankful if somebody is kind enough to tell me how to
fix it, whether providing me a trick to handle the memory/capability
issue of the first case, or fixing the error generated by the second
case.

THANKS A LOT IN ADVANCE!!!

Paolo



More information about the R-sig-Geo mailing list