Skip to content
Prev 4367 / 29559 Next

suggestion to write a more elegant code

Hi,

first, your formulas should read ~a^1.4 etc.; 'a' represents the first 
(and in your case only) grid in in.grids.

Instead of using a formula, you can use a character string:
   formula = "a^1.5" etc.,
so you just have to 'paste' things together; this should work:

for (pow in seq(1.5, 4.0, by = 0.1))
     rsaga.grid.calculus(in.grids = c("DSM_1.sgrd"),
          out.grid = "DCM_1_power15.sgrd",
          formula = paste("a^", pow, sep=""))

Cheers
  Alex
Alessandro wrote: