Blogger

Delete comment from: theBioBucket*

tomp said...

rgdal::readOGR() works almost the same, but you need to strip the '.shp' from the end of the filenames:
shps <- dir(getwd(), "*.shp")
shps <- sub(shps,'\\.shp$')
for (shp in shps) assign(shp, readOGR('.',layer=shp))

You could, of course, replace the for (shp in shps) loop with lapply(), but this is one of the cases where a loop is as fast as a *apply() function.

Sep 18, 2013, 6:39:56 AM


Posted to Loading Multiple Shapefiles to the R-Console Simultaneously

Google apps
Main menu