Skip to content

feature request: has_package() #49

@ijlyttle

Description

@ijlyttle

This idea follows from the "Suggests" section of the R-pkgs book, where you provide the code:

if (!requireNamespace("pkg", quietly = TRUE)) {
  stop("Package \"pkg\" needed for this function to work. Please install it.",
    call. = FALSE)
}

Could this be useful as a new assertion,has_package()?

assertthat::has_package("dplyr")

I'd be happy to make the PR if you think this might be useful. If so, some questions:

  1. Name: has_package(), has_packages(), other?
  2. Should the argument be ... as unnamed, or packages which would be a character-vector of package names, or other?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions