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

Roger Bivand Roger.Bivand at nhh.no
Fri Jun 10 16:56:52 CEST 2005


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 at cabri22.com> aponsero at 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 at nhh.no




More information about the R-help mailing list