[GRASS-stats] raster data in R

Marisa Donnelly madonnelly at ucdavis.edu
Fri Sep 11 00:32:08 PDT 2015


Hi Rainer,
This clarifies things a great deal. I'll try it and let you know, but it
makes sense so I don't anticipate needing an example.
Thank you!
Marisa

On Thu, Sep 10, 2015 at 8:22 PM, Rainer M Krug <r.m.krug at gmail.com> wrote:

>
>
> Envoyé de mon iPhone
>
> > Le 10 sept. 2015 à 16:47, Markus Neteler <neteler at osgeo.org> a écrit :
> >
> > Hi Rainer,
> >
> >> On Thu, Sep 10, 2015 at 4:36 PM, Rainer M Krug <Rainer at krugs.de> wrote:
> >> ...
> >> Just check out the rgrass7 package - readRAST() allows you to read your
> >> raster, then you do your calculations with the data,
> >
> > ... this calculation part is the question of Marisa... any recommended
> > tutorials on how to loop over pixels in R after having used
> > readRAST()?
>
> The data slot of the returned SpatialGridDataFrame is simply a data.frame
> with one cell per row. So you can simply iterate over each row and add the
> results as a new column, which you can then save. If the function is
> vectorizes, you don't even have to iterate but R can do the work. If
> necessary, I can send you a small example tomorrow- just let me know.
>
> Hope this helps,
>
> Rainer
>
> >
> >> then you add them
> >> to the map object in R and finally you can safe them by using
> >> writeRAST() back to GRASS.
> >
> > Yes, that part is clear. Just the "loop" best practice not so much.
> >
> > thanks
> > Markus
>



-- 
Marisa Donnelly
Ph.D. Student
Graduate Group in Epidemiology
University of California, Davis
madonnelly at ucdavis.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-stats/attachments/20150911/19d23156/attachment.html>


More information about the grass-stats mailing list