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 of my 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 bypass the memory/capability issue in the first case (preferably), or fixing the error generated by the second case.
THANKS A LOT IN ADVANCE!!!
perep