reuse: Reuse R objects

View source: R/reuse.R

reuseR Documentation

Reuse R objects

Description

Reuse R objects

Usage

reuse(
  x,
  name,
  board = reuse::board(),
  type = "qs",
  update = getOption("reuse.update", default = FALSE)
)

board()

Arguments

x

An object (typically a data frame) to pin.

name

Pin name.

board

A pin board, created by board_folder(), board_rsconnect(), board_url() or another board_ function.

type

File type used to save x to disk. Must be one of "csv", "rds", "json", "arrow", or "qs". If not supplied will use json for bare lists and rds for everything else.

update

Logical. update the cache?

Value

The R object written to or read from the cache.

Examples

one <- 1 %>% reuse("one")
two <- 2 %>% reuse("one")
two

two <- 2 %>% reuse("one", update = TRUE)
two
withr::local_options(list(reuse.board = pins::board_temp()))
board()

pins::pin_exists(board(), name = "one")
1 %>% reuse("one")
pins::pin_exists(board(), name = "one")

maurolepore/reuse documentation built on May 1, 2022, 7:34 a.m.