On Tue, 13 Feb 2018, Adam Fera wrote:
Hello, Amos,
I came across this posting because I had a similar problem using R for
mapping within GNU Emacs Org Mode on GNU/Linux.? I work on a research
team
that uses a shared directory for data analysis.? This makes it imperative
to use relative pathnames so that everyone can use the exact same
code, the
exact same way, and achieve the exact same result.? Unfortunately, the
readOGR function in the rgdal package does not allow the use of relative
pathnames in the dsn (data source name) argument.
The underlying GDAL logic expects an expanded path. Until I can check
that using path.expand() inside the functions at least for reading,
perhaps writing, use it as dsn =
path.expand("~/relative/path/to/file/nypp_15c/"). I'd be grateful for
feedback on whether this works as well as setwd().
sf uses enc2utf8(normalizePath(dsn)), so you could try normalizePath()
too - path.expand() handles ~ but not ../.. . readGDAL() handles
relative paths OK and uses normalizePath() internally.