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

2019-05-08 Thread Duncan Murdoch
On 08/05/2019 7:16 a.m., Boris Steipe wrote: Have you considered putting the explicit case into a comment? Something like ... # For output to a CSV file, we would assign: myCSV <- "myResults.csv" # ... but for this example we will use the value of tempfile() as the file name: myCSV <-

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

2019-05-08 Thread Boris Steipe
Have you considered putting the explicit case into a comment? Something like ... # For output to a CSV file, we would assign: myCSV <- "myResults.csv" # ... but for this example we will use the value of tempfile() as the file name: myCSV <- tempfile() results <- doSomething(x, csvFile = myCSV,

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

2019-05-07 Thread Duncan Murdoch
On 07/05/2019 6:44 p.m., Uwe Ligges wrote: On 07.05.2019 19:57, Duncan Murdoch wrote: On 06/05/2019 12:16 p.m., Jim Hester wrote: For what it's worth, the recommendation to use `tempfile()` is very confusing to R users. Often users (particularly new users) jump directly to examples when

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

2019-05-07 Thread Uwe Ligges
On 07.05.2019 19:57, Duncan Murdoch wrote: On 06/05/2019 12:16 p.m., Jim Hester wrote: For what it's worth, the recommendation to use `tempfile()` is very confusing to R users. Often users (particularly new users) jump directly to examples when reading documentation and when you have these

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

2019-05-07 Thread Henrik Bengtsson
I agree that setwd(), tempdir(), etc. clutter up examples. At the same time, I respect the CRAN policy - it's conservative approach has helped us avoid a wild-west working environment. One approach that might help bring some standardization, instead of each package developer rolls their own, and

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

2019-05-07 Thread Duncan Murdoch
On 06/05/2019 12:16 p.m., Jim Hester wrote: For what it's worth, the recommendation to use `tempfile()` is very confusing to R users. Often users (particularly new users) jump directly to examples when reading documentation and when you have these more complicated examples they do not realize

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

2019-05-06 Thread Jeff Newmiller
You cannot go littering the user directories with sample files. Such examples would have to be dontrun, but in order to make some of the example runnable as is you would also need examples that use system.file paradigm. If you store the temporary file name in a variable then the user can

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

2019-05-06 Thread Jim Hester
For what it's worth, the recommendation to use `tempfile()` is very confusing to R users. Often users (particularly new users) jump directly to examples when reading documentation and when you have these more complicated examples they do not realize they can just use a simple string literal. See

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

2019-05-03 Thread Duncan Murdoch
On 03/05/2019 6:33 p.m., Jarrett Phillips wrote: Hello, My R package has a function with an argument to specify whether numerical results should be outputted to a CSV file. CRAN policy stipulates verbatim that Packages should not write in the user’s home filespace (including clipboards), nor

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

2019-05-03 Thread Uwe Ligges
On 04.05.2019 00:33, Jarrett Phillips wrote: Hello, My R package has a function with an argument to specify whether numerical results should be outputted to a CSV file. CRAN policy stipulates verbatim that Packages should not write in the user’s home filespace (including clipboards), nor