Loading Multiple Shapefiles to the R-Console Simultaneously
A quick tip on how to load multiple shapefiles (point shapefiles, i.e.) to the R console in one go:
library(maptools)
# get all files with the .shp extension from working directory setwd("D:/GIS_DataBase/GIS_Tirol/Tirol_Verbreitungskarten/Verbreitungs_Daten")
shps <- dir(getwd(), "*.shp")
# the assign function will take the string representing shp and turn it into a variable # which holds the spatial points data for (shp in shps) assign(shp, readShapePoints(shp)) plot(get(shp[1])) # i.e. # ...done
No comments:
Post a Comment