-
Notifications
You must be signed in to change notification settings - Fork 763
Closed
Description
It's slightly annoying to set the package at the beginning of every session. Might I suggest that the current directory be used as the default. This requires very minor changes to the as.package function. I thought this so minor a change that there was no need to include it in a formal pull request.
#' Coerce input to a package.
#'
#' Possibile specifications of package:
#' \itemize{
#' \item path
#' \item name (lookup in .Rpackages)
#' \item package object
#' }
#' @param x object to coerce to a package
#' @export
as.package <- function(x = NULL) {
if (is.null(x)) {
x <- get_last_package()
}
if (is.null(x)) {
message("package not set, checking '.'")
x <- '.'
}
else if (is.package(x))
return(x)
path <- find_package(x)
if (is.null(path)) {
stop("Can't find package ", x, call. = FALSE)
}
pkg <- load_pkg_description(path)
set_last_package(pkg)
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels