I am using ENMeval for model optimisation and coming across the below error when I include a categorical layer as a predictor. The categorical layer (BVGPRE) consists of 36 vegetation categories. Does anyone have any ideas on what the issue could be?
Sce1935_1955C<- ENMevaluate(occ, Stack1935_1955C, bg.coords = NULL, occ.grp = NULL,
bg.grp = NULL, RMvalues = seq(0.5, 5, 0.5), fc = c("L", "LQ", "LQH", "LQHP","LQHPT"),
categoricals = BVGPRE,
n.bg = 10000, method = "randomkfold",
overlap = TRUE, kfolds = 5, bin.output = TRUE, clamp = TRUE,
rasterPreds = TRUE, parallel = TRUE, numCores = 4, progbar = TRUE)
Doing random k-fold evaluation groups...
Error in `[.data.frame`(pres, , categoricals[i]) :
undefined columns selected
> traceback()
7: stop("undefined columns selected")
6: `[.data.frame`(pres, , categoricals[i])
5: pres[, categoricals[i]]
4: is.factor(x)
3: as.factor(pres[, categoricals[i]])
2: tuning(occ, env, bg.coords, occ.grp, bg.grp, method, maxent.args,
args.lab, categoricals, aggregation.factor, kfolds, bin.output,
clamp, rasterPreds, parallel, numCores, progbar, updateProgress,
userArgs)
1: ENMevaluate(occ, Stack1935_1955C, bg.coords = NULL, occ.grp = NULL,
bg.grp = NULL, RMvalues = seq(0.5, 5, 0.5), fc = c("L", "LQ",
"LQH", "LQHP", "LQHPT"), categoricals = BVGPRE,
n.bg = 10000,
method = "randomkfold", overlap = TRUE, kfolds = 2, bin.output = TRUE,
clamp = TRUE, rasterPreds = TRUE, parallel = TRUE, numCores = 4,
progbar = TRUE)