View source: R/createStorage.R
| createStorage | R Documentation |
This function returns an object that implements the methods list(),
save(), load(), remove() that list, store, load or
remove, respectively .rds or .RData files. The object is associated to a
folder that is given to this function.
createStorage(path, type = "rds")
path |
path to the folder in which to store the RDS files. If the folder does not exist it is attempted to be created. |
type |
one of |
list with "member functions" list(), save(),
load(), remove(), and variables path, type
# Create an empty test folder
path <- file.path(tempdir(), "test")
dir.create(path)
# Create a storage object pointing to a temporary test folder
storage <- kwb.utils::createStorage(path)
# At the beginning, the storage is empty
storage$list()
# Store objects
apple <- 5
storage$save(apple, banana = list("Hello", "World"))
## Not run:
# List the objects
storage$list()
# Retrieve an object
storage$load("banana")
# Remove objects
storage$remove("apple")
storage$remove("banana")
# The storage is empty again
storage$list()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.