Over a million developers have joined DZone.

Loading Multiple Shapefiles to the R Console Simultaneously

· Big Data Zone

Here is a quick tip on how to load multiple shapefiles (i.e., point shapefiles) to the R console in one go:

# get all files with the .shp extension from working directory
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


Published at DZone with permission of Kay Cichini , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}