Skip to content
Prev 4858 / 29559 Next

[GRASS-stats] Passing a parameter from R to r.mapcalc ?

On Tue, 20 Jan 2009, Agustin Lobo wrote:

            
Please don't cross-post - people may not be subscribed to both lists and 
this may break threads.

The answer is paste(), or possibly a formatting function:

cmd <- paste("r.mapcalc \'mancha = if(manchas.clmp==", formatC(k, ...),
   ",1,0)\'", sep="")
cmd
cat(cmd, "\n")
system(cmd)

if you need more control of the string going to system(); in my 
experience, eyeballing cmd is very helpful.

Roger