Skip to content
Prev 3851 / 12125 Next

[R-pkg-devel] Writing to files without altering working directory in R package

On 06/05/2019 12:16 p.m., Jim Hester wrote:
I think beginners rarely like the help pages, and that's really to be 
expected:  help pages need to be complete and correct, and beginners 
really need a small subset of possibilities.  Beginners need tutorials.

In the Github issue, you mentioned pollution of the working directory, 
but I think a bigger problem is destruction of user data, e.g. if a user 
has a file "wine.csv", and the example writes to that file.

So you need to do something to protect users.  I think making examples a 
little complicated by using setwd(tempdir()) with a literal filename, or 
writing to tempfile() is worth it.

Duncan Murdoch