[R-pkg-devel] How to write example results to a tempdir()?

Jose A Guijarro jguijarrop at aemet.es
Wed Apr 25 18:30:52 CEST 2018

Dear all,

I am struggling to update my package climatol from version 3.0 to 3.1. 
The old version had all examples under a "dontrun" section because they 
needed files created by other examples that the user had to run first.

As this is not acceptable anymore, I made the examples runnable and 
prepared small ad-hoc datasets, but then writing files to the user space 
is against the CRAN policy rules, and I was suggested to run them on a 
temporal directory. Therefore I changed all my examples to read/write 
files to a tempdir(), as in:

#Set a temporal working directory and write input files:
wd <- tempdir()
data(Ttest) #(This loads matrix 'dat' and data.frame 'est.c')
rm(dat,est.c) #remove loaded data from memory space
#Now run the example:
#Input and output files can be found in directory:

But now CRAN checks return this warning ten times (one for every example 
in the package):

Warning: working directory was changed to ‘/tmp/RtmpWSRK2F’, resetting

Any hint on how to solve the problem will be highly appreciated...


	[[alternative HTML version deleted]]

More information about the R-package-devel mailing list