Loading Multiple Shapefiles to the R Console Simultaneously
Join the DZone community and get the full member experience.
Join For FreeHere is a quick tip on how to load multiple shapefiles (i.e., point shapefiles) 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
R (programming language)
Console (video game CLI)
Published at DZone with permission of Kay Cichini, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Trending
-
An Overview of Kubernetes Security Projects at KubeCon Europe 2023
-
Is Podman a Drop-in Replacement for Docker?
-
Web Development Checklist
-
Transactional Outbox Patterns Step by Step With Spring and Kotlin
Comments