[R] spgrass6 and aggregation (bis)

jessica.gervais at tudor.lu jessica.gervais at tudor.lu
Wed Jun 6 11:35:34 CEST 2007


Dear all,

I have some additionale question concerning the spgrass6 package.

* When you set a region in GRASS, does the readGRASS6 function in R only
load data contained in the zoomed region or the whole map ?

* When you have a MASK map in grass, does the readGRASS6 function in R only
load data contained inside the MASK area ?


Could this be the problem ?

Thanks,

Jessica


########################################################################3

Dear all,


I am exporting grass map into R thanks to the very useful spgrass6 package.

library(spgrass6)

# I have 3 map I am working with a MASK map of a specific area.

# 1) a landuse map
landuse<-readRAST6("landuse_mapname_in_grass")

# 2) a catchment map which divide the area in several catchements
catchment<-readRAST6("catchement_mapname_in_grass")

# 3) a precipitation map
precipitation<-readRAST6("precipitation_mapname_in_grass")


# then I would like to sum the precipitation spatialy over each catchment
and landuse. So, first I cbind all maps with cbind

MAP<-cbind(landuse,catchment,precipitation)

# then I use the aggregate function
SUM<-aggregate(MAP[3],by=list(MAP[1],MAP[2]),sum,na.rm=TRUE)
# here is the problem !!!
Error in as.vector(x, mode) : invalid argument 'mode'

....

I don't find any idea to solve this...

Does anyone has a suggestion ??

Thanks in advance


Jess



More information about the R-help mailing list