Follow the technique that your code already uses (a for() loop to iterate
over a series of values, and a paste() function to generate the filename).

To be more specific:

for(method in 1:3) {
### here, insert the code you posted
## but change:
# paste("DCM_1_power", i+14, ".sgrd", sep="")
## to
# paste("DCM_", method, "_power", i+14, ".sgrd", sep="")
}

Don't forget the opening and closing braces.


On Mon, Oct 20, 2008 at 1:01 PM, Alessandro <alessandro.montaghi@unifi.it>wrote:

>
>
> Hi all,
>
>
>
> I wish improve this code. I have 3 raster DCM_1, DCM_2, and DCM_3 (where:
> DCM= Digital Crown Model) obtained from three methodology. To apply my
> analysis I wish to elevate every raster to power of 1.5 to 4.0 by 0.1.
> Respect to write three times the below formula I wish to understating how
> to write a unique formula to import 3 raster and output DCM_1_power15,
> DCM_2_power15, DCM_3_power15, etc etc.
>
>
>
>
>
> #A# elevation DCM to power of a^1.5 to a^4.0 by=0.1
>
> power<- seq(1.5, 4.0, by=0.1)
>
> for (i in 1:length(power)){
>
>      rsaga.grid.calculus(in.grids = c("DCM_1.sgrd"),
>
>            out.grid = paste("DCM_1_power",i+14,".sgrd",sep=""),
>
>            formula = paste("a^",power[i],sep="")) }
>
>
>
> thanx ale
>
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]


