createProject: Create a project folder, where it contains "0_RawData",...

View source: R/createProject.R

createProjectR Documentation

Create a project folder, where it contains "0_RawData", "Rdata", "Rscript", "figs", "csv", and "ppt" folders. And create two R script files ("00_01_functions.R" and "01_01_readData.R") in Rscript folder. If .git = TRUE, then a git repository will be initialized.

Description

Create a project folder, where it contains "0_RawData", "Rdata", "Rscript", "figs", "csv", and "ppt" folders. And create two R script files ("00_01_functions.R" and "01_01_readData.R") in Rscript folder. If .git = TRUE, then a git repository will be initialized.

Usage

createProject(
  proj,
  path = "./",
  .git = FALSE,
  showWarnings = FALSE,
  inheritProj = NULL,
  inheritFolders = c("Rscript")
)

Arguments

proj

project name

path

the path where the project is created

.git

logical, whether to create a git repository, default is FALSE

showWarnings

logical, whether to show warnings when create the folders, the default is FALSE

inheritProj

the project folder to be inherited, default is NULL

inheritFolders

the folder in the inheritProj project to be copied, the default is c("Rscript")

Value

a list of two elements, i.e., 'dirs' and 'files'. 'dirs' contains all the folders that have been created. 'files' contains all the files that have been created.

Examples

## Not run: 
# Create 'tempProj' project in the current working directory
createProject("tempProj")
dir.exists("tempProj")
unlink("tempProj",recursive = TRUE) # remove this folder
# Create 'tempProj2' project in the home directory
createProject("tempProj2", path = "~/")
dir.exists("~/tempProj2")
unlink("~/tempProj2",recursive = TRUE) # remove this folder
# Create 'tempProj3' project in the home directory and initialize it as a git repository.
# But you need to install git in the system in advance.
createProject("tempProj3", path = "~/", .git = TRUE)
dir.exists("~/tempProj3/.git")
unlink("~/tempProj3",recursive = TRUE) # remove this folder

# Inherit from a project
createProject("tempProj4")
file.create("tempProj4/0_RawData/tmpdataFile.txt") # make a file in 0_RawData folder
createProject("tempProj5", inheritProj = "tempProj4", inheritFolders = c("Rscript", "0_RawData"))
unlink("tempProj4",recursive = TRUE) # remove this folder
unlink("tempProj5",recursive = TRUE) # remove this folder

## End(Not run)

paodan/funcTools documentation built on April 1, 2024, 12:01 a.m.