R/wb_pkg_base_packages.R

Defines functions wb_pkg_base_packages

Documented in wb_pkg_base_packages

#' wb_pkg_base_packages
#'
#' @return character vector with packages already part of the R installation
#'
wb_pkg_base_packages <-
  function(){
    cache <- NULL
    function(){

      # fill cache?
      if ( is.null(cache) ){
        pkg_inst <-
          as.data.frame(
            utils::installed.packages(),
            stringsAsFactors = FALSE
          )
        cache <<- pkg_inst[pkg_inst$Priority %in% c("base", "recommended"), "Package"]
      }

      # return cache
      cache
    }
  }()

Try the wayback package in your browser

Any scripts or data that you put into this service are public.

wayback documentation built on Oct. 23, 2020, 5:47 p.m.