[GRASS-user] Trend-surface analysis with GRASS+R: did something changed in sp package?

Carlos "Guâno" Grohmann carlos.grohmann at gmail.com
Fri Jul 11 14:33:59 EDT 2008


Hi all (sorry for cross-posting)

I trying to do some trend-surface analysis in R using the spatial
package (so I can go up to order 6). It's been a while since the last
I did it, and my previously used steps are not working this time:


>R
>library(spgrass6)
>library(spatial)
>G<-gmeta6()


>G
gisdbase    /home/guano/grassdata
location    amsul_wgs84
mapset      brasil
rows        3120
columns     2640
north       0
south       -26
west        -56
east        -34
nsres       0.00833333
ewres       0.00833333
projection  +proj=longlat +a=6378137 +rf=298.257223563 +no_defs
+towgs84=0.000,0.000,0.000

# GridTopology with 0.1 degree resolution

>grd <- GridTopology(cellcentre.offset=c(-55, -25), cellsize=c(0.1,0.1), cells.dim=c(560, 230));

#here is my data:
>aftaSE <- readVECT6("afta_SE")

# first-order TSA
>idade1<-surf.ls(1,x=coords[,1], y=coords[,2], z=aftaSE$idade)

~so far, so good. now I want to get things as SpatialGridDataFrame, so
I can get them back into GRASS:

>resid1<-residuals(idade1);
>resid2<-as.data.frame(resid1);
>resid.trend<-SpatialPointsDataFrame(coords,resid2);

>resid.img <- SpatialGridDataFrame(grd, resid.trend);
Error in validObject(.Object) :
  invalid class "SpatialGridDataFrame" object: invalid object for slot
"data" in class "SpatialGridDataFrame": got class
"SpatialPointsDataFrame", should be or extend class "data.frame"


This is where I stopped. I had these steps from emails in this list,
and I remember they used to work. Has anything changed I am not aware
of?

TIA

Carlos


-- 
+-----------------------------------------------------------+
 Carlos Henrique Grohmann - Guano
 Geologist M.Sc - Doctorate Student at IGc-USP - Brazil
Linux User #89721 - carlos dot grohmann at gmail dot com
+-----------------------------------------------------------+
_________________
"Good morning, doctors. I have taken the liberty of removing Windows
95 from my hard drive."
--The winning entry in a "What were HAL's first words" contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke

Can't stop the signal.


More information about the grass-user mailing list