Skip to contents

Finds the root directory of the current R project using various heuristics. The function searches for markers like resultcheck.yml, .Rproj files, or a .git directory. When running inside a sandbox created by setup_sandbox(), it will search from the original working directory.

Usage

find_root(start_path = NULL)

Arguments

start_path

Optional. The directory to start searching from. If NULL (default), uses the current working directory or the stored original working directory if in a sandbox.

Value

The path to the project root directory.

Examples

if (FALSE) { # \dontrun{
root <- find_root()
print(root)
} # }