R/crunch.R

Defines functions setIfNotAlready .onLoad

#' @keywords internal
"_PACKAGE"

#' @importFrom httr config add_headers
.onLoad <- function(lib, pkgname = "crunch") {
    setIfNotAlready(
        httpcache.on = TRUE,
        crunch.api = "https://app.crunch.io/api/",
        crunch.namekey.dataset = "alias",
        crunch.namekey.array = "alias"
    )
    set_crunch_config()
    notifyIfNewVersion()
    invisible()
}

setIfNotAlready <- function(...) {
    newopts <- list(...)
    oldopts <- options()
    oldopts <- oldopts[intersect(names(newopts), names(oldopts))]
    newopts <- modifyList(newopts, oldopts)
    do.call(options, newopts)
    invisible(oldopts)
}

Try the crunch package in your browser

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

crunch documentation built on Aug. 31, 2023, 1:07 a.m.