library(mgcv)
forest <- read.table(url("https://raw.githubusercontent.com/eric-pedersen/mgcv-esa-workshop/master/data/forest-health/beech.raw"),
header = TRUE)
forest <- transform(forest, id = factor(formatC(id, width = 2, flag = "0")))
## Aggregate defoliation & convert categorical vars to factors
levs <- c("low","med","high")
forest <- transform(forest,
aggDefol = as.numeric(cut(defol, breaks = c(-1,10,45,101),
labels = levs)),
watermoisture = factor(watermoisture),
alkali = factor(alkali),
humus = cut(humus, breaks = c(-0.5, 0.5, 1.5, 2.5, 3.5),
labels = 1:4),
type = factor(type),
fert = factor(fert))
forest <- droplevels(na.omit(forest))
forest$ph <- as.numeric(forest$ph)
ctrl <- gam.control(nthreads = 3)
Notice removed Draw attention by user293815
Notice added Draw attention by user293815