Most use_*() functions act on the active project. If it is unset, usethis uses rprojroot to find the project root of the current working directory. It establishes the project root by looking for a .here file, an RStudio Project, a package DESCRIPTION, Git infrastructure, a remake.yml file, or a .projectile file. It then stores the active project for use for the remainder of the session. If needed, you can manually override by running proj_set().

In general, user scripts should not call usethis::proj_get() or usethis::proj_set(). They are internal functions that are exported for occasional interactive use. If you need to detect a project programmatically in your code, you should probably be using rprojroot or its simpler companion, here, directly.

proj_get()

proj_set(path = ".", force = FALSE)

Arguments

path

Path to set.

force

If TRUE, use this path without checking the usual criteria. Use sparingly! The main application is to solve a temporary chicken-egg problem: you need to set the active project in order to add project-signalling infrastructure, such as initialising a Git repo or adding a DESCRIPTION file.

Examples

# NOT RUN {
## see the active project
proj_get()

## manually set the active project
proj_set("path/to/target/project")
# }