我的目录中有一个包含多个shapefile的文件(大约2000个),我想在R中读取它们。到目前为止,我已尝试过以下内容:
list.files("my_directory",pattern=".shp")
list_here=list.files("my_directory",pattern=".shp")
for (i in 1:length(list_here)){
bi[[i]]=readShapeSpatial(list_here[i])
proj4string(bi[[i]])= CRS("+proj=longlat +datum=WGS84 +no_defs")
}
但我收到错误Error in getinfo.shape(fn) : Error opening SHP file
每个shapefile都包含.dbf,.prj,.shp,.shx
个文件。当我尝试阅读其中的一个或两个时,我没有问题但是当我尝试在列表中阅读它时,我得到上述错误。
任何人都可以帮助我吗?