'How to specify an categorical layer in the sdm package?

I want to create a sdm model for a plant species.

sp are my species occurences

bio 25 my biolayers from worldclim

and biocateg1 my categorical layer

In Maxent you allways need to specify what are the categoricals layers and i could not find out how to do it with the sdm package.

sp <- read.csv("T_spadiceum/T_spad_occ_data/occ_T_spad_1.csv")
bio25 <- raster::getData('worldclim', var='bio', res=2.5)
biocateg1 <- raster("T_spadiceum/clc_cop_2018/clc_2018_crs84_right_resolution.tif")

normally without a categorical layer this would be the code:

d <- sdmData(species~., sp, bio, bg = list(n=1000, 'gRandom'))


m <- sdm(species~., d, methods=c('maxent'),
         replication=c('boot', 'sub'), n=10, parallelSetting=list(ncore=6, method='parallel'))

p <- predict(m, bio, 'predictions_T_spad.img', overwrite = TRUE)

How do I add my categorical layer to the funcion and make sure that its used as a categorical variable?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source