Given an R object, attempts to store it in the directory basepath/fname. The name given to the file will be of the form DATE.rds, where DATE is of the format %Y_%m_%d_%H_%M. An error will be thrown if basepath does not exist. However, if basepath/fname does not exist, an attempt will be made to create it. The DATE is the current time. Intended to be used with retrieveRDS. See mostRecentTimestamp for an usage example.

storeRDS(obj, fname, basepath = ".")

Arguments

obj

An R object

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 '.'

Value

A message announcing the path the object has been written to

Examples

saveRDS(mtcars, 'cars') saveRDS(mtcars, 'cars') # Now the filesystem has, in '.': # +-- mtcars # ¦   +-- 2020_04_09_16_40.rds # ¦   +-- 2020_04_09_16_41.rds