search for: movingfun

Displaying 3 results from an estimated 3 matches for "movingfun".

2013 Mar 19
1
How to get the rolling standard deviation in rasters?
I am using this code to calculate the moving average mean.It worked fine but when I wanted to also calculate based on sd(stander deviation) I got the error shown below. I read this documentation of R movingFun and found that sd was mentioned at http://hosho.ees.hokudai.ac.jp/~kubo/Rdoc/library/raster/html/movingFun.html I wonder if needs any other things to conseder or sd is not at all supplied by this function. sami<- list.files("C:\\Usersfinal-2010", "*.envi", full.name...
2013 Mar 18
4
Why stacking rasters return NAs?
I have several rasters that I want to do some calculations ,basically calculating the moving average. dir2 <- list.files("D:\\2010+2011", "*.bin", full.names = TRUE) saf=stack(dir2) movi <- overlay(stack(saf),fun=function(x) movingFun(x, fun=mean, n=3, na.rm=TRUE)) Error in .overlayList(x, fun = fun, filename = filename, ...) : cannot use this formula, probably because it is not vectorized I then checked the data but found that all values were returnd as NA and this may explain why i am getting the error...
2013 Feb 14
0
How write raster files after manipulation?
...,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 worked without errors but I want to write the results and check them: I tried several ways of writing but all of them got errors: 1)for (i in seq_along(results)) { fileName <- sprintf("C:\\New folder (3)\\final-2010.bin"...