create_bcgov_project: Create a bcgov R project directory structure

Description Usage Arguments Examples

View source: R/create.R

Description

Create a project directory structure for a new bcgov R project in your current working directory.

Usage

1
2
3
4
5
6
7
8
9
create_bcgov_project(
  path = ".",
  rmarkdown = FALSE,
  licence = "apache2",
  coc_email = get_coc_email(),
  dir_struct = getOption("bcgovr.dir.struct", default = NULL),
  rstudio = rstudioapi::isAvailable(),
  open = TRUE
)

Arguments

path

Path to the directory in which to initialize the project. Default "." - your current working directory.

rmarkdown

Should an Rmarkdown file be added to the repository with its corresponding markdown file? Default FALSE.

licence

Which licence to apply? Default is Apache 2.0 ("apache2"). Use "cc-by" for Creative Commons Attribution 4.0

coc_email

Contact email address(es) for the Code of Conduct. It is recommended that you save this setting by adding a line like: options("bcgovr.coc.email" = "your.email@gov.bc.ca") to your .Rprofile. Use usethis::edit_r_profile() for an easy way to find and edit this file.

dir_struct

Alternative project directory structure. This should be specified as a character vector of directory (i.e. folders) and file paths, relative to the root of the project. Directories should be identified by having a trailing forward-slash (e.g., "dir/").

The default is: c("R/", "data/", "out/", "01_load.R", "02_clean.R", "03_analysis.R", "04_output.R", "run_all.R").

This can also be set as an option bcgovr.dir.struct. You may want to set this in your .Rprofile file so that every time you start a new project, your custom project structure is set up. The line in your .Rprofile file would look something like this: options("bcgovr.dir.struct" = c("doc/", "data/", "results/", "src/01_load.R", "src/02_clean.R", "src/03_analysis.r", "src/04_output.R", "src/run_all.R"))

rstudio

If TRUE, calls usethis::use_rstudio() to make the new project into an RStudio Project. If FALSE, a .here file is created so that the directory can be recognized as a project by the here or rprojroot packages.

open

If TRUE and in RStudio, the new project is opened in a new instance, if possible, or is switched to, otherwise.

Examples

1
2
3
4
## Not run: 
 bcgovr::create_bcgov_project()

## End(Not run)

bcgov/bcgovr documentation built on Oct. 11, 2021, 2:02 p.m.