[STATSGRASS] R-GRASS error in region changes

javier garcia - CEBAS rn001 at cebas.csic.es
Mon Feb 21 05:15:27 EST 2005


Hi all;
I guess that Roger B. is the best person to answer this, anyway I send the 
question to everybody in the list (I think it is interesting):
I'm trying to do an R script to do a statistical analysis over GRASS maps, 
and I obtain an error. Perhaps the link R-GRASS doesn't allow to do what I'm 
trying?

Through my R script I'm changing the region in GRASS, and after this I get 
some maps from GRASS into R, what gives an error:

-----------------
# R script
library(GRASS)
for (i in 33:1) {
  g.region <- paste("g.region n=9.9 s=0 e=3.3 w=0 res=",3.3/i,sep="")
  system(g.region)
  system(paste("r.mapcalc template",i,"=1",sep=""))
  rm(G)
  G <- gmeta()
  RGRASS <- rast.get(G, rlist=paste("template",i,sep=""), catlabels=FALSE)
}
-----------------

The R error message appears in the second loop:
Error in rast.get(G, rlist = paste("template", i, sep = ""), catlabels = 
FALSE) :
        Current GRASS region changed: ns_res


Could be any possibility to succeed with this?

Thanks and best regards,

Javier




More information about the grass-stats mailing list