# [R-sig-Geo] problem with gridded

Pierre Roudier pierre.roudier at gmail.com
Thu Dec 9 06:28:38 CET 2010

```Hi Agnieszka,

This question is not easy to answer because unfortunately you gave
very few details. I assume you want to use the function gridded() on

First thing you have to do is to make your dataset a Spatial object.
This is done using the coordinates() function:

library(sp)
coordinates(alu) <- ~x+y # Again, I'm just guessing x and y are the
spatial coordinates
class(alu)

The class of alu should be "SpatialDataFrame"

If your data set is on a *regular* grid, you may want to use the
gridded() function to make alu a Grid:

gridded(alu) <- TRUE

At this point, you may have the following error:
suggested tolerance minimum: 0.142857142857143
Error in points2grid(points, tolerance, round, fuzz.tol) :
dimension 1 : coordinate intervals are not constant

This means your data set is not regularly gridded. You may want to use
the points2grid function, which has a tolerance parameter.
If your dataset is not gridded, and you need to generate a prediction
grid (eg for kriging), I advise you to use the spsample function (see
?spsample).

hope this helps,

Pierre

2010/12/9 Agnieszka Kaczmarczyk <agnes.kaczmarczyk at gmail.com>:
> Hello,
> I have to gridded my data alu:
> class(alu)
> [1] "data.frame"
> alu[1:3,1:3]
>        x       y   al
> 1 4384104 5570084 0.20
> 2 4384068 5570297 0.15
> 3 4384111 5570551 0.08
> I use function: gridded(), spsample(),points2grid(),GridTopology(),
> expand.grid() ect.
> I read The meuse data set: a tutorial for the gstat R package and other
> tutorial for R. I can't solve this problem. I'm interesting geostatistic
> simulation. Can you help me with my problem?
> With best regards,
> Agnieszka
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

```