R/get.project.R

Defines functions get.project .has.project

Documented in get.project

#' Show information about the current project.
#'
#' This function will return all of the information that
#' ProjectTemplate2has about the current project. This information is
#' gathered when \code{\link{load.project}} is called. At present,
#' ProjectTemplate2keeps a record of the project's configuration settings,
#' all packages that were loaded automatically and all of the data sets that
#' were loaded automatically. The information about autoloaded data sets
#' is used by the \code{\link{cache.project}} function.
#'
#' @details In previous releases this information has been available through the
#'   global variable \code{project.info}.  Using this variable is now deprecated
#'   and will result in a warning.
#'
#' @return A named list.
#'
#' @export
#'
#' @seealso \code{\link{create.project}}, \code{\link{load.project}},
#'   \code{\link{cache.project}}, \code{\link{show.project}}
#'
#' @examples
#' library('ProjectTemplate2')
#'
#' \dontrun{load.project()
#'
#' get.project()}
get.project <- function()
{
  tryCatch(
    get("project.info", envir = .TargetEnv, inherits = FALSE),
    error = function(e) stop("Project must be loaded using load.project().")
  )
}

.has.project <- function()
{
  exists("project.info", envir = .TargetEnv)
}
connectedblue/ProjectTemplate2 documentation built on May 17, 2019, 2:46 p.m.