pin: Pin a resource (legacy API)

View source: R/pin.R

pinR Documentation

Pin a resource (legacy API)


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())

# new api
board <- board_local()
board %>% pin_write(mtcars)
board %>% pin_read("mtcars")

pins documentation built on Nov. 10, 2023, 1:06 a.m.