Re: [R] In connection with the creation of a grid of point with gstat

From: Roger Bivand <Roger.Bivand_at_nhh.no>
Date: Sat 11 Jun 2005 - 00:56:52 EST


On Fri, 10 Jun 2005, alain ponsero wrote:

>
>
> Hi ALL,
>
> With the pakage gstat
>
>
>
> How can one create a grid of points as in the meuse.grid example, from
> measuring sites as in the Meuse example
>

In the meuse example, the meuse.grid locations are provided. They are essentially the same as the code snippet in the example for predict.gstat():

     # unconditional simulation on a 100 x 100 grid
     xy <- expand.grid(1:100, 1:100)
     names(xy) <- c("x","y")
     g.dummy <- gstat(formula = z~1, locations = ~x+y, dummy = TRUE, beta = 0,
             model = vgm(1,"Exp",15), nmax = 20)
     yy <- predict(g.dummy, newdata = xy, nsim = 4)

that is using expand.grid() and giving the output object the correct names for your coordinates. If you need to mask the grid, you need to choose just some rows of xy for prediction (perhaps using the overlay() method in the sp package).

>
>
> Thanks in advance!
>
>
>
> Alain PONSERO
> Conservateur
> Réserve Naturelle de la Baie de Saint-Brieuc
> site de l'Etoile
> 22120 HILLION
> tel/fax : 02.96.32.31.40
> <mailto:aponsero@cabri22.com> aponsero@cabri22.com
> <http://www.reservebaiedesaintbrieuc.com/reserve.htm>
> http://www.reservebaiedesaintbrieuc.com/reserve.htm
> ><(((°>
>
>
>
> [[alternative HTML version deleted]]
>
>

-- 
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@nhh.no

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Sat Jun 11 01:01:55 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:30 EST