cachedRDSload: Cached Loading of RDS Files

Description Usage Arguments Details Value Author(s) Examples

View source: R/ramwas.r

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

1
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

1
2
3
4
5
6
7
8
9
### 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")

andreyshabalin/ramwas documentation built on Sept. 27, 2021, 7:25 p.m.