[R-pkg-devel] Error in CHECK caused by dev.off()

David Cortes d@v|d@corte@@r|ver@ @end|ng |rom gm@||@com
Thu Jul 23 13:16:22 CEST 2020


It is explained here:
https://cran.r-project.org/web/packages/policies.html
Section about source packages:
"Packages should not write in the user’s home filespace (including
clipboards), nor anywhere else on the file system apart from the R
session’s temporary directory (or during installation in the location
pointed to by TMPDIR: and such usage should be cleaned up)."

And I think the policy was different at some point in the past. Anyway,
it's a good policy - just get a temporary folder and your desired file
name - e.g.:
file.path(tempdir(), "your_file.png")

Best regards,
David Cortes

On Thu, 2020-07-23 at 12:44 +0200, Helmut Schütz wrote:
> Dear Duncan,
> 
> Duncan Murdoch wrote on 2020-07-22 23:48:
> > On 22/07/2020 5:40 p.m., Helmut Schütz wrote:
> > > 
> > > Duncan Murdoch wrote on 2020-07-22 21:42:
> > > 
> > > > During a check, it probably wouldn't, because you aren't
> > > > allowed to 
> > > > write to "~/".  Your package should be writing to tempdir(), or
> > > > a 
> > > > location entered by the user.
> > > 
> > > The user is asked to provide a certain path indeed. Only if none
> > > is 
> > > provided, the fallback is "~/" (which is always writable). 
> > 
> > That disqualifies your package from inclusion on CRAN.
> 
> Can you please point to such a policy in the R-Extension Manual?
> Eight 
> versions of the package were accepted by CRAN and three times checked
> by 
> members of the team.
> 
> BTW, the package passed on winbuilder:
> Your package replicateBE_1.0.14.9000.tar.gz has been built (if
> working) 
> and checked for Windows.
> Please check the log files and (if working) the binary package at:
> https://win-builder.r-project.org/k2tGfNoY7y88
> The files will be removed after roughly 72 hours.
> Installation time in seconds: 41
> Check time in seconds: 251
> Status: 1 NOTE
> R version 4.0.2 (2020-06-22)
> Hence, I suspect that there is a problem with CHECK which I run
> locally 
> on my machine.
> 
> > If no destination is provided and tempdir() isn't acceptable, you 
> > shouldn't write anything.  The user may be keeping an
> > irreplaceable 
> > piece of information in "~/test.png", and your package would
> > destroy 
> > it.  It's not your decision to make to trespass on the user's file
> > space.
> 
> The package is used in a regulated environment (e.g., for the FDA).
> The 
> name of the file is always unique, i.e., depends on the input. The
> code 
> checks whether a file with the same name already exist and -- if yes
> -- 
> asks the user to confirm overwriting it.
> The man-pages make clear that a path should be provided. If none is 
> provided, a message is issued informing the user that results are
> saved 
> in the home directory. By using tempdir() the user would have to
> move 
> all files to another location before the session is closed.
> 
> Helmut
>



More information about the R-package-devel mailing list