data(bioclim_example)
# The 19 WorldClim bioclimatic variables (https://www.worldclim.org/data/bioclim.html)
# Many are highly correlated, making them ideal for pruning
# Remove highly correlated variables
pruned <- corrPrune(bioclim_example[, -1], threshold = 0.7)
ncol(pruned) # Reduced from 19 to ~8 variables
# Model-based pruning with VIF
model_data <- modelPrune(species_richness ~ .,
data = bioclim_example,
limit = 5)
attr(model_data, "selected_vars")
Run the code above in your browser using DataLab