Initialize a project with subdirectories cache/
, modules/
,
inputs/
, outputs/
, and setPaths
accordingly.
If invoked from Rstudio, will also create a new Rstudio project file.
newProject(name, path, open)
# S4 method for character,character,logical
newProject(name, path, open)
# S4 method for character,character,missing
newProject(name, path, open)
project name (name of project directory)
path to directory in which to create the project directory
Logical. Should the new project file be opened after creation?
Default TRUE
in an interactive session.
invoked for side effect of project file creation
myProjDir <- newProject("myProject", tempdir())
#> Setting:
#> options(
#> reproducible.cachePath = '/tmp/Rtmpd0rH1m/myProject/cache'
#> spades.inputPath = '/tmp/Rtmpd0rH1m/myProject/inputs'
#> spades.outputPath = '/tmp/Rtmpd0rH1m/myProject/outputs'
#> spades.modulePath = '/tmp/Rtmpd0rH1m/myProject/modules'
#> )
#> Paths set to:
#> options(
#> rasterTmpDir = '/tmp/Rtmpd0rH1m/SpaDES/scratch/raster'
#> reproducible.cachePath = '/tmp/Rtmpd0rH1m/myProject/cache'
#> spades.inputPath = '/tmp/Rtmpd0rH1m/myProject/inputs'
#> spades.outputPath = '/tmp/Rtmpd0rH1m/myProject/outputs'
#> spades.modulePath = '/tmp/Rtmpd0rH1m/myProject/modules'
#> spades.scratchPath = '/tmp/Rtmpd0rH1m/SpaDES/scratch'
#> )
#> terra::terraOptions(tempdir = '/tmp/Rtmpd0rH1m/SpaDES/scratch/terra'
dir.exists(file.path(myProjDir, "cache"))
#> [1] TRUE
dir.exists(file.path(myProjDir, "inputs"))
#> [1] TRUE
dir.exists(file.path(myProjDir, "modules"))
#> [1] TRUE
dir.exists(file.path(myProjDir, "outputs"))
#> [1] TRUE
unlink(myProjDir, recursive = TRUE) ## cleanup