Displaying 2 results from an estimated 2 matches for "movingmean".
2013 Feb 18
1
How to calculate the moving average for binary files?
...https://echange-fichiers.inra.fr/get?k=k3M2jatJyHy65Cs99G4 .
I would like to calculate the moving average for the 12 values for each
pixel in the 12 files.
For a simple vector we can get a moving average by using this :
x <- c(1,2,3,NA,NA,4,6,5,6,4,2,5)
movingmean <- rollapply(x, 3, FUN = mean, na.rm = T,fill=NA)
now I want to do the same but with binary files and I tried:
files <- list.files("C:final-2010", "*.envi", full.names = TRUE)
results <- list()
for (.files in files) {
# read in the 12 files as a v...
2013 Feb 14
0
How write raster files after manipulation?
...https://echange-fichiers.inra.fr/get?k=k3M2jatJyHy65Cs99G4 .
I would like to calculate the moving average for the 12 values for each
pixel in the 12 files.
For a simple vector we can get a moving average by using this :
x <- c(1,2,3,NA,NA,4,6,5,6,4,2,5)
movingmean <- rollapply(x, 3, FUN = mean, na.rm = T)
now I want to do the same but with rasters and I tried:
files <- list.files("C:final-2010", "*.envi", full.names = TRUE)
results<- overlay(stack(files), fun=function(x) movingFun(x, fun=mean,
n=3, na.rm=TRUE))
That w...