Learn R Programming

wizaRdry (version 0.2.6)

scry: Initialize the wizaRdry directory structure inside an R project

Description

Creates the standard directory structure required for the wizaRdry package to function properly. This includes folders for data cleaning scripts, NDA submission templates, and temporary outputs. It can detect and repair incomplete directory structures, and optionally create an R project.

Usage

scry(
  study_alias = NULL,
  path = ".",
  overwrite = FALSE,
  repair = FALSE,
  show_tree = NULL,
  create_project = FALSE,
  examples = FALSE,
  skip_prompt = TRUE
)

Value

Invisible TRUE if successful.

Arguments

study_alias

Character string specifying the short name for the study e.g. impact, capr, sing

path

Character string specifying the directory path where the structure should be created. Defaults to the current working directory.

overwrite

Logical. If TRUE, will overwrite existing files. If FALSE (default), will not replace existing files.

repair

Logical. If TRUE, will attempt to repair an incomplete directory structure. If FALSE, will abort with an error message when encountering an incomplete structure.

show_tree

Logical. If TRUE (default on first run), will display a visual file tree. Set to FALSE to suppress the tree view.

create_project

Logical. If TRUE, will create an R project file if one doesn't exist. If FALSE (default), will not create an R project.

examples

Logical. If TRUE (default when not repairing), will create example script templates. If FALSE (default when repairing), will skip creating example scripts.

skip_prompt

Logical. If TRUE (default), will skip the initial confirmation prompt if y/n preferences are not set yet. FALSE if specified.

Details

The function creates the following directory structure:

  • clean/

    • csv/

    • mongo/

    • qualtrics/

    • redcap/

    • sql/

  • nda/

    • csv/

    • mongo/

    • qualtrics/

    • redcap/

    • sql/

  • tmp/

It also creates template config.yml and secrets.R files, and optionally an R project file.

Examples

Run this code
if (FALSE) {
# Initialize in current directory
scry()

# Repair structure in current directory
scry(repair = TRUE)

# Initialize in a specific directory with an R project
scry("path/to/project", create_project = TRUE, repair = TRUE)

# Skip the tree display
scry(repair = TRUE, show_tree = FALSE)

# Explicitly create example scripts when repairing
scry(repair = TRUE, examples = TRUE)

# Skip the confirmation prompt
scry(skip_prompt = TRUE)
}

Run the code above in your browser using DataLab