Julian,

You can use the files make a RasterStack s, then, you can get all values in
a data.frame like this:

d <- as.data.frame(s)

And the coordinates for corresponding cells:

xy <- xyFromCell(s, 1:ncell(s))

Robert

On Fri, Jul 13, 2012 at 6:40 PM, Julian WITTISCHE <jwittische@hotmail.com>wrote:

>
> Hello everybody,
> I have managed to make bioclim grids from WORLDCLIM .bil files on R (
> http://www.worldclim.org/)
> I got this:> head(grids);
> $bio1
> class       : RasterLayer
> dimensions  : 7200, 7200, 51840000  (nrow, ncol, ncell)
> resolution  : 0.008333333, 0.008333333  (x, y)
> extent      : -150, -90, 0, 60  (xmin, xmax, ymin, ymax)
> coord. ref. : NA
> values      :
> C:\Users\Julian\AppData\Local\Temp\R_raster_tmp\raster_tmp_4239836849.grd
> min value   : -123
> max value   : 295
>
>
> $bio2
> class       : RasterLayer ...
>
> and I got this kind of array for each BIOCLIM variable:
> > head(grids$bio1);
>      1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18
>  19  20
> 1  -20 -20 -20 -19 -18 -18 -18 -17 -16 -16 -16 -14 -14 -13 -12 -11 -10  -9
>  -8 -11
> 2  -20 -20 -19 -18 -18 -18 -17 -17 -16 -15 -14 -14 -13 -12 -11  -9  -8  -7
>  -6  -4
> 3  -19 -19 -18 -18 -18 -17 -16 -16 -15 -14 -14 -13 -12 -10  -8  -7  -6  -5
>  -4  -4
>
> What I need to do is to transform this in a dataframe with
> long,lat,bio1,...,bio19 as columns:
>
> My main issue is how to get long and lat from this. Is it possible to
> divide the extent in 7200 to get those ? How can I do it efficiently? I
> tried a few times but I can't make it.Then I'll need to associate each
> long, lat with its variable values.
> Thank you for any piece of advice,
> Julian
>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]

