knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of reuse is to avoid re-running slow computations, particularly in pipes.
reuse::reuse()
combines features of pins::pin_read()
and pins::pin_write()
with some differences:
board
explicitly.reuse()
or globally with options()
.You can install the development version of reuse like so:
# install.packages("devtools") devtools::install_github("maurolepore/reuse")
library(reuse)
one <- 1 %>% reuse("one") two <- 2 %>% reuse("one") two
update
.two <- 2 %>% reuse("one", update = TRUE) two
reuse.update
.options(reuse.update = TRUE) three <- 3 %>% reuse("one") three
cache_dir <- rappdirs::user_cache_dir("reuse") dir.exists(file.path(cache_dir, "one"))
library(pins) board <- board_folder(cache_dir) board %>% pin_meta("one") board %>% pin_delete("one")
board
.custom <- pins::board_folder(tempdir()) 1 %>% reuse("abc", board = custom) pins::pin_read(board = custom, "abc")
reuse.board
.options(reuse.board = custom) 1 %>% reuse("def", board = custom) pins::pin_exists(board = custom, "def")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.