find_project_root: Find the Project Root

View source: R/find_project_root.R

find_project_rootR Documentation

Find the Project Root

Description

This function recursively searches for the project root, defined as the directory containing an .Rproj file. It starts in the current directory and moves up the directory tree until it either finds an .Rproj file or reaches a directory with no parent.

Usage

find_project_root(setwd = TRUE)

Arguments

setwd

Logical. change the working directory to project root? Defaults to TRUE.

Value

The directory path containing an .Rproj file. Throws an error if no .Rproj file is found in the directory tree above the current directory.

Note

Be careful when running this function, as it could end up searching a large portion of your file system if no .Rproj file is found.

Examples

## Not run: 
find_project_root()

## End(Not run)

natehall329/nate_utils documentation built on Dec. 31, 2024, 3:25 p.m.