This function identifies and returns the working directory of an RStudio project (`*.Rproj`) that is located at or above the current working directory.

get_project_wd()

Value

A character string representing the directory path to the RStudio project (`*.Rproj`) file. If no such file is found, the function returns `NULL` and a message indicating that there are no `.Rproj` files in your directory.

Details

If there's a project directory within the current directory or its parent directories, it will return the path to that directory. If no such directory is found, it sends a message indicating that no `.Rproj` files were found and does not change the working directory.

Author

Xiaotao Shen <shenxt1990@outlook.com>

Examples

if (FALSE) {
get_project_wd()
}