I'm trying to create an object with name "trainData' and where 'samples_area ' is a shapefile layer with polygons only. I've set the directory to the folder that contains 'samples_area'
code line:
trainData <- readOGR("samples_area", "polygons")
Error message:
Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv, :
Cannot open data source
This error means that rgdal was unable to open the file. It is most often caused by misspelled file name - are you certain your shapefile has no extension?
With my little knowledge in R (m new in R programming), I read somewhere that if you are using readOGR() function do not add file extension. Yes the ESRI shapefile has .shp extension...
After reading you, I added .shp (I thinks that's what you want to say), but the problem persists.