Web site with book resources (data, scripts)
This web site contains scripts and datasets to reproduce all the examples in
Roger S. Bivand is Professor of Geography in the Department of Economics at Norwegian School of Economics, Bergen, Norway.
Edzer Pebesma is Professor of Geoinformatics at Westfälische Wilhelms-Universität, Münster, Germany.
Virgilio Gómez-Rubio is Associate Professor in the Department of Mathematics at Universidad de Castilla-La Mancha, Albacete, Spain.
Data set bundles (.zip files for all datasets occuring in a chapter of the book), for chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10.
Verbatim (unchanged) book scripts, for chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10.
Updated and simplifed book scripts, for chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10.
A script that downloads all scripts is:
ASDAR_BOOK <- "https://asdar-book.org/book2ed"
chapters <- c("hello", "cm", "vis", "die", "cm2",
"std", "sppa", "geos", "lat", "dismap")
for (i in chapters) {
fn <- paste(i, "mod.R", sep="_")
download.file(paste(ASDAR_BOOK, fn, sep = "/"), fn)
}
To run all examples of the book, a number of packages need to be installed. Running the following script will install those that are not already present:
pkgs <- c("boot", "CARBayes", "classInt", "coda", "cubature",
"DCluster", "deldir", "epitools", "geoR", "ggplot2", "gstat",
"INLA", "lattice", "latticeExtra", "lmtest", "maps", "maptools",
"MASS", "McSpatial", "mgcv", "nlme", "osmar", "pgirmess", "plm",
"R2BayesX", "R2WinBUGS", "raster", "RColorBrewer", "rgdal", "rgeos",
"sandwich", "sp", "spacetime", "spatstat", "spdep", "spgwr", "sphet",
"splancs", "xts")
for (p in pkgs) {
if (inherits(try(library(p, character.only = TRUE)), "try-error"))
install.packages(p, character.only = TRUE)
}
A script that downloads all data and scripts, extracts data, and reproduces the whole book is:
chapters <- c("hello", "cm", "vis", "die", "cm2",
"std", "sppa", "geos", "lat", "dismap")
for (i in chapters) {
ASDAR_BOOK <- "https://asdar-book.org"
fn <- paste(i, "mod.R", sep="_")
download.file(paste(ASDAR_BOOK, "book2ed", fn, sep = "/"), fn)
da <- paste(i, "bundle.zip", sep = "_")
download.file(paste(ASDAR_BOOK, "bundles2ed", da, sep = "/"), da)
unzip(da)
source(fn, echo = TRUE)
}
The data and scripts of the first edition of the book,
are found here: