[GRASSLIST:2219] converting GRASS data for trend surface analysis in R

Hello all

I'm trying to do some trend surface analysis with GRASS data in R, but I with
some problems:

1 - when I get the raster from GRASS, surf.ls() doesn't accept it, since its not
in x,y,z format:

str(isobase)

List of 1
$ isobases.auto: num [1:241266] 771 770 769 768 767 ...

So, how can I change this to a format that surf.ls() understands?

2 - I'll try several degrees of surfaces, so I'll use surf.ls(), but what about
residuals? can I get them with residuals()?

thanks in advance

Carlos Grohmann

--
+-------------------------------------------------+
        Carlos Henrique Grohmann - Guano
    Geologist - MSc Student at IGc-USP - Brazil
       Linux User #89721 ICQ: 214752832
+-------------------------------------------------+

Hello all

I'm trying to do some trend surface analysis with GRASS data in R, but I
with some problems:

1 - when I get the raster from GRASS, surf.ls() doesn't accept it, since
its not in x,y,z format:

str(isobase)

List of 1
$ isobases.auto: num [1:241266] 771 770 769 768 767 ...

So, how can I change this to a format that surf.ls() understands?

isobase$isobases.auto is the z argument. You can generate the x by east()
of the object returned by gmeta(), and y by north() of this object. I'm
not sure how well surf.ls() scales to this number of points, though.

2 - I'll try several degrees of surfaces, so I'll use surf.ls(), but
what about residuals? can I get them with residuals()?

Yes, residuals() should work. Again, scaling to this number of points is
an issue. On the other hand, the residuals and fitted values will drop
straight into the GRASS location.

Roger

thanks in advance

Carlos Grohmann

--
+-------------------------------------------------+
        Carlos Henrique Grohmann - Guano
    Geologist - MSc Student at IGc-USP - Brazil
       Linux User #89721 ICQ: 214752832
+-------------------------------------------------+

--
Roger Bivand
NHH, Breiviksveien 40, N-5045 Bergen, Norway

Hello.

I did as Roger said, and used

base2 <- surf.ls(2, east(G), north (G), isobase)

but then I get this error msg:

Error in as.double.default(z) : (list) object cannot be coerced to double

How can fix it?
I tried as.double(), but get the same msg.

Thanks again

Carlos
--
+-------------------------------------------------+
        Carlos Henrique Grohmann - Guano
    Geologist - MSc Student at IGc-USP - Brazil
       Linux User #89721 ICQ: 214752832
+-------------------------------------------------+

Citando Roger Bivand <Roger.Bivand@nhh.no>:

> Hello all
>
> I'm trying to do some trend surface analysis with GRASS data in R, but I
> with some problems:
>
> 1 - when I get the raster from GRASS, surf.ls() doesn't accept it, since
> its not in x,y,z format:
>
>> str(isobase)
> List of 1
> $ isobases.auto: num [1:241266] 771 770 769 768 767 ...
>>
>
> So, how can I change this to a format that surf.ls() understands?
>

isobase$isobases.auto is the z argument. You can generate the x by east()
of the object returned by gmeta(), and y by north() of this object. I'm
not sure how well surf.ls() scales to this number of points, though.

> 2 - I'll try several degrees of surfaces, so I'll use surf.ls(), but
> what about residuals? can I get them with residuals()?
>
Yes, residuals() should work. Again, scaling to this number of points is
an issue. On the other hand, the residuals and fitted values will drop
straight into the GRASS location.

Roger

> thanks in advance
>
> Carlos Grohmann
>
> --
> +-------------------------------------------------+
> Carlos Henrique Grohmann - Guano
> Geologist - MSc Student at IGc-USP - Brazil
> Linux User #89721 ICQ: 214752832
> +-------------------------------------------------+

--
Roger Bivand
NHH, Breiviksveien 40, N-5045 Bergen, Norway