#' @importFrom dplyr %>%
#' @importFrom raster crop getData merge subset xmax xmin ymin
#' @importFrom utils globalVariables
#' @export
get_bioclim <-
function(layer, extent, var = "bio") {
lapply(
c(xmin, xmax),
function(x) {
getData(
"worldclim",
var = var,
res = 0.5,
lon = do.call(x, list(extent)),
lat = ymin(extent)
) %>%
crop(extent, snap = "out")
}
) %>%
do.call(merge, .) %>%
subset(layer)
}
globalVariables(".")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.