cachedRDSload {ramwas} | R Documentation

## Cached Loading of RDS Files

### Description

Loads an .rds file `rdsfilename` using `readRDS` and returns the loaded object. The object is also saved in a cache so that repeated calls of the function with the same filename return the same object instanteneously.

### Usage

    cachedRDSload(rdsfilename)

### Arguments

`rdsfilename` | Name of the RDS file.

### Details

The cached object is stored in a private package environment.

### Value

Returns the object loaded with `readRDS` from `rdsfilename` at this or a previous call of the function.

### Author(s)

Andrey A Shabalin andrey.shabalin@gmail.com

### Examples

    ### Change filename to hg19 CpGset

    filename = system.file("extdata", "qc_sample.rds", package = "ramwas")

    time1 = system.time( {obj1 = cachedRDSload(filename)} )
    time2 = system.time( {obj1 = cachedRDSload(filename)} )

    cat("First  loading time:",time1[3],"seconds","\n")
    cat("Second loading time:",time2[3],"seconds","\n")

[Package ramwas version 1.14.0 Index]