knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
Creates a cache in binary in the file system for any R object, returning a reference to the cache file. This is useful if have many R objects to deal with, an cannot fit them all at once in your memory.
devtools::install_github("iqis/stash")
require(stash) require(magrittr)
Make a stash.
mtc_stash <- stash(mtcars) mtc_stash
This means that mtcars is written into the above location. (It is also thus exposed that I use Windows.)
Access the stash's content with an empty []
.
mtc_stash[] %>% head()
If you need to do any subsetting, you may chain []
or $
right after.
mtc_stash[][1:5, "mpg"] mean(mtc_stash[]$cyl)
The object also provides access other useful information.
mtc_stash$obj_class mtc_stash$obj_size mtc_stash$file_path mtc_stash$has_stash_file() mtc_stash$has_content()
Currently, as the data set is stashed on to the disc, we don't have a copy in the memory. But we can load it.
mtc_stash$has_content() mtc_stash$load_content() mtc_stash$has_content() mtc_stash[]
We can also remove the in-memory content to release memory. But we still can read from the disk as in the beginning.
mtc_stash$remove_content() mtc_stash$has_content()
mtc_stash[]
Finally we can also remove the stash on the disk. If we do this now, we will end with no data anywhere.
mtc_stash$remove_stash() mtc_stash$has_stash_file() mtc_stash[]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.