R/is_r_project.r

Defines functions is_r_project

Documented in is_r_project

#' Checks if `path` contains a valid R project structure
#'
#' Checks if `path` contains:
#' - a DESCRIPTION file
#' - a NAMESPACE file
#' - an R directory
#'
#' @md
#' @param path path to check for an R project (defaults to `getwd()`)
#' @export

is_r_project <- function(path = getwd()) {
  file.exists(file.path(path, "DESCRIPTION")) &&
    file.exists(file.path(path, "NAMESPACE")) &&
    dir.exists(file.path(path, "R"))
}
giupo/rutils documentation built on June 12, 2025, 9:35 p.m.