Retrieves an RDS file stored in basepath/fname that has the closest modification date to goalDate. If no such file exists, an error will be thrown.

retrieveRDS(fname, basepath = ".", goalDate = Sys.time())

Arguments

fname

The name of the directory in basepath where various revisions of the file are stored. I.e., file.txt should be a directory, with revisions of the true file.txt stored inside of it.

basepath

A string. The path which stores fname. Default '.'

goalDate

The 'goal' date for the revision we are trying to retrieve. Whichever file is closest in time to the 'goal' date will be selected

Examples

storeRDS(mtcars, 'mtcars')
#> Wrote object to ./mtcars/2020_04_16_23_22.rds
identical(mtcars, retrieveRDS('mtcars'))
#> [1] TRUE
storeRDS(mtcars, 'mtcars', basepath='.')
#> Wrote object to ./mtcars/2020_04_16_23_22.rds
mtcars2 <- mtcars mtcars2[,'cyl'] <- 1 storeRDS(mtcars2, 'mtcars')
#> Wrote object to ./mtcars/2020_04_16_23_22.rds
mtcars_retrieved <- retrieveRDS('mtcars', goalDate = lubridate::now()) identical(mtcars, mtcars_retrieved)
#> [1] FALSE