0

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

perep1972
  • 147
  • 1
  • 9
  • Side note: #1 Giving a minimal reproducible example increases chances of getting answers (although it might be difficult here). #2 You might be more lucky at http://gis.stackexchange.com/ (but should make a reference in case you cross-post). – lukeA Nov 20 '16 at 02:45
  • 1
    Thank you @lukeA. Effectively, that's difficult to post a reproducible examble. I repeated the question at http://gis.stackexchange.com/questions/218422/r-language-problems-with-spatialpixelsdataframe – perep1972 Nov 20 '16 at 11:39

0 Answers0