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)

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