initialize_project: Initializes project

View source: R/initialize_project.R

initialize_projectR Documentation

Initializes project

Description

org::initialize_project takes in 2+ arguments. It then saves folder locations in the return value (a new environment) and in org::project, which you will use in all of your subsequent code. An additional folder will be created on the user's file system (org::project$results_today) which corresponds to results/YYYY-MM-DD. The sourced folders are saved into org::project$env.

Usage

initialize_project(
  env = new.env(),
  home = NULL,
  results = NULL,
  folders_to_be_sourced = "R",
  source_folders_absolute = FALSE,
  encode_from = "UTF-8",
  encode_to = "latin1",
  ...
)

Arguments

env

The environment that the code will be sourced into (use .GlobalEnv to source code into the global environment)

home

The folder containing 'Run.R' and 'R/'

results

A folder inside results with today's date will be created and it will be accessible via org::project$results_today (this is where you will store all of your results)

folders_to_be_sourced

The names of folders that live inside home and all .r and .R files inside it will be sourced into the global environment.

source_folders_absolute

If TRUE then folders_to_be_sourced is an absolute folder reference. If FALSE then folders_to_be_sourced is relative and inside home.

encode_from

Folders current encoding (only used on Windows)

encode_to

Folders final encoding (only used on Windows)

...

Other folders that you would like to reference

Details

For more details see the help vignette: vignette("intro", package = "org")

Value

Returns an environment that contains:

  • Folder locations

  • An environment called env into which the code has been sourced into. There is also a side effect where org::project mirrors these values.

Examples


org::initialize_project(
  home = paste0(tempdir(), "/git/analyses/2019/analysis3/"),
  results = paste0(tempdir(), "/dropbox/analyses_results/2019/analysis3/"),
  raw = paste0(tempdir(), "/data/analyses/2019/analysis3/")
)
org::project$results_today
org::project$raw


org documentation built on Nov. 22, 2022, 9:05 a.m.