I've noticed that rgdal
functions work differently on different operating systems. Check how dsn
is defined in the script and maybe there may be the problem.
I can tell you about my experience working on both OS X and Windows. To read a shapefile, it is executed as a generic:
library(rgdal)
readOGR(dsn,layer)
In OS X, none of the following options raise an error:
readOGR(dsn='/ruta/a/carpeta/',layer='prueba')
readOGR(dsn='/ruta/a/carpeta',layer='prueba')
In Windows, the second works for me without problems, but the first throws the following error:
Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv, :
Cannot open layer
So if the work folder contains a /
at the end, it could be that it is generating an error in your case.