if (FALSE) {
file <- system.file("external/spain.grd", package="usdm")
r <- brick(file) # reading a RasterBrick object including 10 raster layers in Spain
r
vif(r) # calculates vif for the variables in r
v1 <- vifcor(r, th=0.9) # identify collinear variables that should be excluded
v1
v2 <- vifstep(r, th=10) # identify collinear variables that should be excluded
v2
}
Run the code above in your browser using DataLab