Re: [R] Putting R script in a function.

2014-10-30 Thread John Wasige
Hello community, I need help on how I can perform PCA on stacked raster (multiple bands/ layers) in R. Does any body have an idea or script? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/m

Re: [R] Putting R script in a function.

2014-10-28 Thread Adams, Jean
Frederic, You can simplify your code somewhat using vectorization and the cumsum() function instead of a for loop. Since you focus in on a single year, perhaps you could do the calculations for all the years, and store the result in an array, instead. Then you could grab any day*month matrix fro