[STATSGRASS] R - GRASS and r.reclass

javier garcia - CEBAS rn001 at cebas.csic.es
Wed Dec 17 15:40:49 EST 2003


Hi all;
I'm trying to do a thing related to the link between R and GRASS. Although 
not directly related with statistics , perhaps this is a good place to pose 
the doubt.

I've done some very simple scripts to execute repeated operations on 25 GRASS 
maps. The problem is to pass values of reclassification rules to r.reclass.
I've tried:
  
for (i in 1:25) {
string <- paste("r.reclass input=imagen",i,"end output=imarec",i,sep="")
cat(string,"\n")
system(string)
system("253 = 192")
system("252 = 96")
system("251 = 48")
system("250 = 24")
system("249 = 12")
system("221 = 8")
system("193 = 7")
system("165 = 6")
system("133 = 4")
system("102 = 3")
system("70 = 2")
system("39 = 1")
system("* = NULL")
system("end")
}


But this doesn't work. I think that this could be also with a bash script, 
but I don't know anything about bash. Could this operation be done in some 
way from R, or in a easy way launched from the R script? Perhaps something as 
to pass the classification rules from a file? (I don't know how to do this, 
either)

Could you give me a hand with this?

Thanks and best regards,

Javier





More information about the grass-stats mailing list