[R-sig-Geo] Reading Shapefile from 600 directories

Roger Bivand Roger.Bivand at nhh.no
Tue Jun 23 11:22:20 CEST 2009

On Mon, 22 Jun 2009, cheong yoon ling wrote:

> Hi!
> I am wondering how to read shapefiles from 600 respective folders at
> one shot? The name of the shapefile is the same thoroughly. The name
> of the 600 folders is indexed in a main autocad .dwg file.

If you can read the list of folders in appropriate software, and pass it 
into R as a character vector, yes, of course. Note that the .dwg formats 
are proprietary and cannot be read in R - can you discover the folder 
names in any other way? Are there shapefiles with the same name in other 
folders, or can you just search the file system for the target shapefile 
name? Once you have the vector of folder names, just loop over them using 
your choice of shapefile reading function and prefered object class in R 
(packages rgdal, maptools, maybe others too). Your choice will depend on 
why you want to read them in.


> Thanks a lot
> Grace
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no

More information about the R-sig-Geo mailing list