# NOT RUN {
# Generate dummy RasterLayer
r <- raster(nrows = 1, ncols = 1,
xmn = 0, xmx = 360, ymn = -90, ymx = 90, vals = 0.3)
names(r) <- as.Date("2018-01-01")
# Generate dummy RasterBrick
b <- raster::brick(lapply(1:(365 * 3),
function(i) raster::setValues(r, runif(raster::ncell(r)))))
names(b) <- seq.Date(from = as.Date("1993-01-01"),
to = as.Date("1995-12-31"),
by = "day")
# Compute anomaly
x <- anomaly(r, b)
# This plots nicely using rasterVis::levelplot(), see example on GWIS
# (\url{https://gwis.jrc.ec.europa.eu}
rasterVis::levelplot(x, col.regions = colorRamps::matlab.like(n = 11))
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab