I am generating a regression model using several environmental covariates. Before importing the GIS layers to GRASS I had them as ESRI raster format. I exported them to ASCII file, and from ASCII file I imported them to GRASS. I did this a couple of momths ago, I believe, because I was having trouble finding a different way of importing the layers directly from ESRI raster.
In GRASS I did several operations and corrections of my raster files. After, I used the package spgrass6 to import the raster files to R, directly. I created a SpatialGridDataFraME
In my preliminary data exploration I see a lot of nan, and I wonder whether I did any mistake exporting the files to ASCII files, or whether is these nan's are normal, since I have many empty cells in my grid (cells outside my study region, but that are within the box, or the grid defined by the region in GRASS).
I want to get rid of NA values, and so I tried:
region.pt <- as.(region, 'SpatialPointsDataFrame')
But it gave me an error:
cannot allocate vector of size 2.3 Gb
My SpatialGridDataFrame is 1.9 GB!!!
Should I clean all these nan values BEFORE importing them into GRASS, or before importing them into R?
Or is it OK to oblige the spatialGridDataFrame to become SpatialPointsDataFrame?
What will happen with nan's?
How can I get only the pixels within my study area?