library(maptools) library(rgdal) # Download and extract grids: download.file("http://spatial-analyst.net/book/system/files/usgrids5km.zip", destfile=paste(getwd(), "usgrids5km.zip", sep="/")) grid.list <- c("dairp.asc", "dmino.asc", "dquksig.asc", "dTRI.asc", "gcarb.asc", "geomap.asc", "globedem.asc", "minotype.asc", "nlights03.asc", "sdroads.asc", "twi.asc", "vsky.asc", "winde.asc", "glwd31.asc") for(j in grid.list){ fname <- zip.file.extract(file=j, zipname="usgrids5km.zip") file.copy(fname, paste("./", j, sep=""), overwrite=TRUE) } # plot the predictors: library(adehabitat) image(as.kasc(list(geomap=import.asc("geomap.asc"), nlights03=import.asc("nlights03.asc"), dTRI=import.asc("dTRI.asc"), gcarb=import.asc("gcarb.asc"))))