R/utils.R

Defines functions use_cache

use_cache <- function(id, op, dir = tempdir()) {
    id <- digest::digest(id)
    fp <- file.path(dir, paste0(id, ".rds"))
    if (file.exists(fp)) {
        readRDS(fp)
    } else {
        data <- eval(parse(text = op), envir = parent.frame())
        saveRDS(data, file = fp)
        data
    }
}

Try the UCSCXenaTools package in your browser

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

UCSCXenaTools documentation built on Sept. 15, 2021, 5:07 p.m.