[GRASSLIST:10494] Re: help with R and GRASS6
Roger Bivand
Roger.Bivand at nhh.no
Tue Feb 21 13:39:51 EST 2006
Hi Carlos,
On Tue, 21 Feb 2006, Carlos "Guâno" Grohmann wrote:
> Hello list
>
> I've away from R a while, and now I'm struggling with it...
> I read Bivand's artile in GRASS-News3, but I dindn't understant exactly how
> the data is stored in R.
>
Please see a note in R News in November 2005 by Edzer Pebesma and me.
> If I want to make a trend-surface analysis with surf.ls(), I need the x,y
> and z coordinates of each point (or pixel), but I don't know how to get
> these values
The object returned by getSites6sp() is a SpatialPointsDataFrame. You can
get the coordinates by saying:
pointlayer <- getSites6sp("mypoints")
coords <- coordinates(pointlayer)
and assuming z is called z:
myTSA <- surf.ls(2, x=coords[,1], y=coords[,2], z=pointlayer$z)
but you can also do TSA straight away in gstat:
myTSA_with_gstat <- gstat(id="tr2", formula = z ~ 1, data = pointlayer,
degree=2)
(the most recent gstat just takes the location coordinates from the
SpatialPointsDataFrame object.)
There was a thread about this recently, I think copied to:
http://grass.gdf-hannover.de/twiki/pub/GRASS/WebHome/krigingusingRGRASS6.txt
where a grid is created from the GRASS region settings to predict to.
Hope this helps,
Roger
>
> the whole idea is to make TSA, then variogram fitting in the residuals, then
> krigging (maybe with gstat or geoR, still haven't decided)
>
> thanks
>
> --
> +-----------------------------------------------------------+
> 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
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the grass-user
mailing list