From 34e1e18b962eb114980418ba9c0510e3fccd38bb Mon Sep 17 00:00:00 2001 From: Robin Lovelace Date: Sun, 4 Oct 2020 13:42:00 +0100 Subject: [PATCH] Fix #576 --- 07-read-write-plot.Rmd | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/07-read-write-plot.Rmd b/07-read-write-plot.Rmd index 21fe06209..11a02aa8e 100644 --- a/07-read-write-plot.Rmd +++ b/07-read-write-plot.Rmd @@ -107,8 +107,14 @@ A second example downloads a series of rasters containing global monthly precipi The result is a multilayer object of class `RasterStack`. ```{r 07-read-write-plot-5} +if(!file.exists("prec_10m_bil.zip")) { + u = "https://github.com/Robinlovelace/geocompr/releases/download/1.2/prec_10m_bil.zip" + download.file(u, "prec_10m_bil.zip") + unzip("prec_10m_bil.zip", exdir = "prec") +} library(raster) -worldclim_prec = getData(name = "worldclim", var = "prec", res = 10) +worldclim_prec = stack(list.files("prec", pattern = "bil", full.names = TRUE)) +# worldclim_prec = getData(name = "worldclim", var = "prec", res = 10) class(worldclim_prec) ```