R/get.installation.time.R

Defines functions get.installation.time

# Get installation time for a given `pkg` and `vrs`. This is estimated from
# CRAN data about installation time on their build servers.
#
# Example:
# groundhog:::get.installation.time("magrittr", "1.5")
# 

get.installation.time <- function(pkg, vrs) {
  if (is.null(.pkgenv[["cran.times"]])) {
    load.cran.toc()
  }
  cran.times <- .pkgenv[["cran.times"]]

  dfk <- cran.times[cran.times$pkg_vrs == paste0(pkg, "_", vrs), ] # subset of package
  if (nrow(dfk) == 1) {
    return(dfk$installation.time) # lookup installation times
  } else {
    return(180)
  } # if not found, assume 3 minutes
}

Try the groundhog package in your browser

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

groundhog documentation built on May 29, 2024, 7:55 a.m.