Skip to contents

Returns the absolute path of the directory holding _study.yml, found by walking up from start. Errors if there is none, naming the directories walked.

Usage

study_root(start = getwd())

Arguments

start

Character. Directory to start the upward walk from. Defaults to getwd().

Value

Character(1). The absolute path of the study root.

Examples

root <- file.path(tempdir(), "study-root-example")
dir.create(root, showWarnings = FALSE)
yaml::write_yaml(
  list(study = "Example", built = "example.sas7bdat"),
  file.path(root, "_study.yml")
)
study_root(root)
#> [1] "/tmp/RtmpAxnHxw/study-root-example"
unlink(root, recursive = TRUE)