I would use tempfile() instead of /tmp/. That should create a file/directory that will get cleaned up when the R session ends, instead of when the machine reboots. AFAIK it also works on windows.
On Mon, Jun 29, 2015 at 8:25 AM, Jonathan Callahan < jonat...@mazamascience.com> wrote: > Hi, > > The MazamaSpatialUtils > <http://cran.r-project.org/package=MazamaSpatialUtils> package has a > required "package state" variable which users set to specify where they > want to store large amounts of GIS data that is being downloaded and > converted by the package. The implementation of this follows Hadley's > advice here: > > http://adv-r.had.co.nz/Environments.html#explicit-envs > > The functionality is implemented with package environment and getter and > setter functions: > > spatialEnv <- new.env(parent = emptyenv()) > spatialEnv$dataDir <- NULL > > > getSpatialDataDir <- function() { > if (is.null(spatialEnv$dataDir)) { > stop('No data directory found. Please set a data directory with > setSpatialDataDir("YOUR_DATA_DIR").',call.=FALSE) > } else { > return(spatialEnv$dataDir) > } > } > > > setSpatialDataDir <- function(dataDir) { > old <- spatialEnv$dataDir > dataDir <- path.expand(dataDir) > tryCatch({ > if (!file.exists(dataDir)) dir.create(dataDir) > spatialEnv$dataDir <- dataDir > }, warning = function(warn) { > warning("Invalid path name.") > }, error = function(err) { > stop(paste0("Error in setSpatialDataDir(",dataDir,").")) > }) > return(invisible(old)) > } > > > My question is: > > *What is an appropriate directory to specify for vignettes (or demos or > examples) that need to go through CRAN testing?* > > The R code in vignettes need to specify a directory that is writable during > the package build process but that will also be available to users. > > Should we create a /tmp/<hash> directory? Would that be available on all > systems? > > Alternatively, > > *What is an alternative to vignettes and demos for tutorial scripts that > should not be tested upon submission to CRAN?* > > > Thanks for any suggestions. > > Jon > > > -- > Jonathan Callahan, PhD > Mazama Science > 206-708-5028 > mazamascience.com > > [[alternative HTML version deleted]] > > ______________________________________________ > R-package-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-package-devel > [[alternative HTML version deleted]] ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel