[R-pkg-devel] Dealing with not so temporary files

Joris Meys Joris.Meys at ugent.be
Tue Mar 13 09:52:14 CET 2018

Duncan gave one option. The other option is to provide a specific
write2disk() function or so that allows the user to determine whether
he/she wants to save the data. Then the user can decide exactly where he
wants to find it.

The other important part is the format in which it's saved. Users can
simply use save() or write.csv() (or any of the readr functions if you
must) to store whatever data they want in the format they want. There's a
lot of database connections possible as well if that's needed. The only
reason I see to provide a specific write function or argument, is when the
storage is done in a nonstandard format. And then it makes sense to provide
both read_myformat() and write_myformat() in some form. That's what I as an
R user would expect.

Fwiw: I have seen the commotion on that discussion recently as well, but
this is really nothing new. For as long as I remember, writing to disk only
happens when you use a function that does explicitly that. Which makes
sense as well, as eg my students often run R in a shared environment during
classes, and sysadmins don't like software that starts writing files


On Tue, Mar 13, 2018 at 12:32 AM, Duncan Murdoch <murdoch.duncan at gmail.com>

> On 12/03/2018 6:26 PM, Roy Mendelssohn - NOAA Federal wrote:
>> Hi All:
>> Recently there was a proper admonishment to a developer that it is bad
>> etiquette writing to a user's home directory,  and for temporary files use
>> the functions tempdir() and tempfile().  I am working on a new package
>> (presently on Github) that downloads data from a remote server,  reads the
>> data into R,  but I would like to save that file for the user to access
>> later if they so desire.  Saving to the "temp directory" is not a good
>> option for that,  want to put it somewhere where the user can easily find
>> it.  What is the proper etiquette for this?  Even if I provide an argument
>> for the user to specify the location to save the file,  I should provide a
>> default location.
> Why not provide an argument whose default is something given by tempfile()?
> Duncan Murdoch
>> Any suggestions appreciated.
>> -Roy
>> **********************
>> "The contents of this message do not reflect any position of the U.S.
>> Government or NOAA."
>> **********************
>> Roy Mendelssohn
>> Supervisory Operations Research Analyst
>> Environmental Research Division
>> Southwest Fisheries Science Center
>> ***Note new street address***
>> 110 McAllister Way
>> Santa Cruz, CA 95060
>> Phone: (831)-420-3666
>> Fax: (831) 420-3980
>> e-mail: Roy.Mendelssohn at noaa.gov www: http://www.pfeg.noaa.gov/
>> "Old age and treachery will overcome youth and skill."
>> "From those who have been given much, much will be expected"
>> "the arc of the moral universe is long, but it bends toward justice" -MLK
>> Jr.
>> ______________________________________________
>> R-package-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
> ______________________________________________
> R-package-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel

Joris Meys
Statistical consultant

Department of Data Analysis and Mathematical Modelling
Ghent University
Coupure Links 653, B-9000 Gent (Belgium)

tel: +32 (0)9 264 61 79
Biowiskundedagen 2017-2018

Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

	[[alternative HTML version deleted]]

More information about the R-package-devel mailing list