[R-sig-Geo] index a SpatialGridDataFrame

Paul Hiemstra p.hiemstra at geo.uu.nl
Thu Dec 20 15:03:47 CET 2007


Ingo Holz wrote:
> Hi,
>
>  I would like to add data to a SpatialGridDataFrame (SGDF) in a loop.
>
>  Something like
>
>  for (i in 1:20){
>     ....
>     SGDF[,,i] <- sgdf[,,1]
>     }  # sgdf is a SpatialGridDataFrame which is modified in the loop
>
>  I get the error message that it is not possible to index an object of type S4.
>
>  Ok..., but how can I add data to a SGDF in a loop? No way?
>
> Thanks for your help,
> Ingo
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>   
Hi Inge,

It can be done by something like:

SGDF[[i]] = sgdf[[1]]

cheers,
Paul

-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: 	+31302535773
Fax:	+31302531145
http://intamap.geo.uu.nl/~paul




More information about the R-sig-Geo mailing list