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.
myProjDir <- newProject("myProject", tempdir())
#> Setting:
#> options(
#> reproducible.cachePath = '/tmp/RtmppEYNhs/myProject/cache'
#> spades.inputPath = '/tmp/RtmppEYNhs/myProject/inputs'
#> spades.outputPath = '/tmp/RtmppEYNhs/myProject/outputs'
#> spades.modulePath = '/tmp/RtmppEYNhs/myProject/modules'
#> )
#> Paths set to:
#> options(
#> rasterTmpDir = '/tmp/RtmppEYNhs/SpaDES/scratch/raster'
#> reproducible.cachePath = '/tmp/RtmppEYNhs/myProject/cache'
#> spades.inputPath = '/tmp/RtmppEYNhs/myProject/inputs'
#> spades.outputPath = '/tmp/RtmppEYNhs/myProject/outputs'
#> spades.modulePath = '/tmp/RtmppEYNhs/myProject/modules'
#> spades.scratchPath = '/tmp/RtmppEYNhs/SpaDES/scratch'
#> )
#> terra::terraOptions(tempdir = '/tmp/RtmppEYNhs/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