# NOT RUN {
require("raster")
set.seed(6)
temp <- list()
for(i in 1:100) {
temp[[i]] <- runif(36,-1, 1)
temp[[i]] <- matrix(temp[[i]], 6, 6)
temp[[i]] <- raster(temp[[i]])
}
temp <- brick(temp)
writeRaster(temp,"temporal.tif", overwrite=T)
rm(temp)
ndvisim <- brick("temporal.tif")
date <- seq(from = 1990.1, length.out = 100, by = 0.2)
eco.theilsen(ndvisim, date)
slope <- raster("slope.tif")
pvalue <- raster("pvalue.tif")
par(mfrow = c(1, 2))
plot(slope, main = "slope")
plot(pvalue, main = "p-value")
file.remove(c("temporal.tif", "slope.tif", "pvalue.tif"))
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab