# NOT RUN {
random.raster <- function(r=50, c=50, l=10, min=0, max=1){
do.call(stack, replicate(l, raster(matrix(runif(r*c, min, max),r,c))))
}
r <- random.raster()
# Smooth time-series
r.smooth <- smooth.time.series(r, f = 0.2, smooth.data = TRUE)
# sp SpatialPixelsDataFrame example
r <- as(r, "SpatialPixelsDataFrame")
r@data <- smooth.time.series(r, f = 0.2, smooth.data = TRUE)
r <- stack(r) # coerce back to raster stack object
# }
Run the code above in your browser using DataLab