I'm trying to import shapefiles into R but receiving errors. I'm using rgdal package and doing the following:

x <- readOGR(".", "SNP Basefile")

Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv, : Cannot open layer

I used dsn="." since I had placed the shapefile in the current working directory. "SNP Basefile.shp" is the shapefile I'm trying to import.

  • 1
    Please use list.files(".") to see for sure all the required files are there – mdsumner Feb 22 '17 at 7:28
  • Maybe possible a problem with the space on the name, will try later – mdsumner Feb 22 '17 at 7:29
  • I suggest just loading the file, the way you load a raster: readOGR("Path to file") – Vijay Ramesh Mar 17 '17 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.