Skip to content
Framework

Workflow

project_path()

A path from the project root

Joins its arguments under the project root and returns an absolute path, like here::here(). The same call gives the same path from any folder in the project, so code in notebooks/ and a script in the root find the same file. The file need not exist. framework-py calls it fw.path().

Usage

project_path(...)

Arguments

Name Description
...

Path parts relative to the project root, joined in order. A part may hold slashes ("outputs/tables"). No parts gives the root itself. An absolute or rooted part ("/etc", "C:/data", "\\data", "~/x") is an error.

Value

The absolute path, a character string. The root is written with forward slashes on every system.

Examples

Not run

if (FALSE) {
project_path()                            # The project root
project_path("outputs/tables", "incidence.csv")  # From any folder in the project
file.exists(project_path("outputs", "tables", "incidence.csv"))
}

Search guides and reference for R, Python, Stata, the CLI, and Framework Cloud.