[R] GRASS raster data processing

Roger Bivand Roger.Bivand at nhh.no
Fri Jun 12 12:37:58 CEST 2009


Perhaps reading ?readRAST6 would help? It does say:
   vname: A vector of GRASS 6.0 raster file names

so you could write:

Kar <- readRAST6(c("Incis_Kar", "DEM_Kar"), plugin=FALSE)

and plot(Incis_Kar ~ DEM_Kar, data=Kar) should get you there - in spearfish:

sp <- readRAST6(c("erosion1", "elevation.dem"), plugin=FALSE)
plot(erosion1 ~ elevation.dem, data=sp)

works for me. (Aside - using @ in S4 classes should be avoided unless you
both know what you are doing and need to be doing it, use the provided
access mechanisms, here treating a Spatial*DataFrame as an ordinary data
frame.)

Roger



Nikos Alexandris wrote:
> 
> 
> Maayt:
>> I just imported two raster maps into R using the SPGRASS6 package, one
>> containing elevation data and the other containing an erosion index:
> 
>> Kar_inc <-readRAST6("Incis_Kar", plugin=FALSE)
>> Kar_dem <- readRAST6("DEM_Kar", plugin=FALSE)
>> 
>> I just wanted to make a xy plot of erosion parameter vs elevation. How
>> does
>> this work? I don't get how to handle SpatialGridDataFrames...
> 
> 
> Maarten,
> 
> you can check some web-pages with respect to GRASS & R [1][2]. This is a
> question for grass-stats actually [3].
> 
> A quick answer: check the structure of the newly created object and you
> will find that the "numbers" are to be found in (e.g. for "Incis_Kar" )
> Kar_inc at data$Incis_Kar.
> 
> So use "@data" and the "$" to access a "slot".
> Kind regards, Nikos
> ---
> 
> [1] http://grass.osgeo.org/wiki/R
> [2] http://grass.ibiblio.org/statsgrass/index.php#grassR
> [3] http://grass.osgeo.org/statsgrass/index.php
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/GRASS-raster-data-processing-tp23981740p23996501.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list