
Last chance! 50% off unlimited learning
Sale ends in
Pins the given resource locally or to the given board.
pin(x, name = NULL, description = NULL, board = NULL, ...)
An object, local file or remote URL to pin.
The name for the dataset or object.
Optional description for this pin.
The board where this pin will be placed.
Additional parameters.
pin()
allows you to cache remote resources and intermediate results with ease. When
caching remote resources, usually URLs, it will check for HTTP caching headers to avoid
re-downloading when the remote result has not changed.
This makes it ideal to support reproducible research by requiring manual instruction to download resources before running your R script.
In addition, pin()
still works when working offline or when the remote resource
becomes unavailable; when this happens, a warning will be triggered but your code will
continue to work.
pin()
stores data frames in two files, an R native file (RDS) and a 'CSV' file. To
force saving a pin in R's native format only, you can use pin(I(data))
.
This can improve performance and size at the cost of making the pin unreadable from other
tools and programming languages.
# old API
board_register_local(cache = tempfile())
pin(mtcars)
pin_get("mtcars")
# new api
board <- board_local()
board %>% pin_write(mtcars)
board %>% pin_read("mtcars")
Run the code above in your browser using DataLab