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 class 'character,character,logical'
newProject(name, path, open)

# S4 method for class 'character,character,missing'
newProject(name, path, open)

Arguments

name

project name (name of project directory)

path

path to directory in which to create the project directory

open

Logical. Should the new project file be opened after creation? Default TRUE in an interactive session.

Value

invoked for side effect of project file creation

Examples

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