R/reqInstall.R

Defines functions .req reqInstall

Documented in reqInstall

#' require a package, and if it isn't installed, install it
#' 
#' @param p   the package to require/install
#' 
#' @return    whatever require() or install.packages() returns 
#'
#' @examples
#' reqInstall("BiocManager") 
#'
#' @import tidytext 
#' 
#' @export
reqInstall <- function(p) {
  if (!.req(p)) install.packages(p)
  .req(p)
}


# helper
.req <- function(p) require(p, character.only=TRUE) 
VanAndelInstitute/ExpDesign2021 documentation built on Dec. 18, 2021, 6:15 p.m.