# pins The pins package publishes data, models, and other R objects, making it easy to share them across projects and with your colleagues. You can pin objects to a variety of pin *boards*, including folders (to share on a networked drive or with services like DropBox), Posit Connect, Databricks, Amazon S3, Google Cloud Storage, Azure storage, and Microsoft 365 (OneDrive and SharePoint). Pins can be automatically versioned, making it straightforward to track changes, re-run analyses on historical data, and undo mistakes. You can use pins from Python as well as R. For example, you can use one language to read a pin created with the other. Learn more about [pins for Python](https://rstudio.github.io/pins-python/). ## Installation You can install pins from CRAN with: ``` r install.packages("pins") ``` You can install the development version from GitHub: ``` r # install.packages("pak") pak::pak("rstudio/pins-r") ``` ## Usage To use the pins package, you must first create a pin board. A good place to start is [`board_folder()`](https://pins.rstudio.com/reference/board_folder.md), which stores pins in a directory you specify. Here I’ll use a special version of [`board_folder()`](https://pins.rstudio.com/reference/board_folder.md) called [`board_temp()`](https://pins.rstudio.com/reference/board_folder.md) which creates a temporary board that’s automatically deleted when your R session ends. This is great for examples, but obviously you shouldn’t use it for real work! ``` r library(pins) board <- board_temp() board #> Pin board #> Path: #> '/var/folders/hl/v1lzqxfd07b3hgd2tt5cjcs40000gp/T/Rtmpcv8YZU/pins-2b2828988b4b' #> Cache size: 0 ``` You can “pin” (save) data to a board with [`pin_write()`](https://pins.rstudio.com/reference/pin_read.md). It takes three arguments: the board to pin to, an object, and a name: ``` r board |> pin_write(head(mtcars), "mtcars") #> Guessing `type = 'rds'` #> Creating new version '20260309T003903Z-5d990' #> Writing to pin 'mtcars' ``` As you can see, the data saved as an `.rds` by default, but depending on what you’re saving and who else you want to read it, you might use the `type` argument to instead save it as a Parquet, Arrow, CSV, or JSON file. You can later retrieve the pinned data with [`pin_read()`](https://pins.rstudio.com/reference/pin_read.md): ``` r board |> pin_read("mtcars") #> mpg cyl disp hp drat wt qsec vs am gear carb #> Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4 #> Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4 #> Datsun 710 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1 #> Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1 #> Hornet Sportabout 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2 #> Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1 ``` A board on your computer is good place to start, but the real power of pins comes when you use a board that’s shared with multiple people. To get started, you can use [`board_folder()`](https://pins.rstudio.com/reference/board_folder.md) with a directory on a shared drive or in dropbox, or if you use [Posit Connect](https://posit.co/products/enterprise/connect/) you can use [`board_connect()`](https://pins.rstudio.com/reference/board_connect.md): ``` r board <- board_connect() #> Connecting to Posit Connect 2024.08.0 at board |> pin_write(tidy_sales_data, "sales-summary", type = "rds") #> Writing to pin 'hadley/sales-summary' ``` Then, someone else (or an automated Quarto report) can read and use your pin: ``` r board <- board_connect() board |> pin_read("hadley/sales-summary") ``` You can easily control who gets to access the data using the Posit Connect permissions pane. The pins package also includes boards that allow you to share data on services like Databricks Volumes ([`board_databricks()`](https://pins.rstudio.com/reference/board_databricks.md)), Amazon’s S3 ([`board_s3()`](https://pins.rstudio.com/reference/board_s3.md)), Azure’s blob storage ([`board_azure()`](https://pins.rstudio.com/reference/board_azure.md)), and Google Cloud Storage ([`board_gcs()`](https://pins.rstudio.com/reference/board_gcs.md)). Learn more in [`vignette("pins")`](https://pins.rstudio.com/articles/pins.md). # Package index ## Pins - [`pin_read()`](https://pins.rstudio.com/reference/pin_read.md) [`pin_write()`](https://pins.rstudio.com/reference/pin_read.md) : Read and write objects to and from a board - [`pin_meta()`](https://pins.rstudio.com/reference/pin_meta.md) : Retrieve metadata for a pin - [`pin_download()`](https://pins.rstudio.com/reference/pin_download.md) [`pin_upload()`](https://pins.rstudio.com/reference/pin_download.md) : Upload and download files to and from a board - [`pin_versions()`](https://pins.rstudio.com/reference/pin_versions.md) [`pin_version_delete()`](https://pins.rstudio.com/reference/pin_versions.md) [`pin_versions_prune()`](https://pins.rstudio.com/reference/pin_versions.md) : List, delete, and prune pin versions - [`pin_list()`](https://pins.rstudio.com/reference/pin_list.md) : List all pins - [`pin_search()`](https://pins.rstudio.com/reference/pin_search.md) : Search for pins - [`pin_delete()`](https://pins.rstudio.com/reference/pin_delete.md) : Delete a pin - [`pin_browse()`](https://pins.rstudio.com/reference/pin_browse.md) : Browse source of a pin - [`pin_reactive_read()`](https://pins.rstudio.com/reference/pin_reactive_read.md) [`pin_reactive_download()`](https://pins.rstudio.com/reference/pin_reactive_read.md) : Wrap a pin in a reactive expression - [`pin_exists()`](https://pins.rstudio.com/reference/pin_exists.md) : Determine if a pin exists ## Boards Boards abstract over different storage backends, making it easy to share data in a variety of ways. - [`board_azure()`](https://pins.rstudio.com/reference/board_azure.md) : Use an Azure storage container as a board - [`board_connect()`](https://pins.rstudio.com/reference/board_connect.md) [`board_rsconnect()`](https://pins.rstudio.com/reference/board_connect.md) : Use Posit Connect as board - [`board_connect_url()`](https://pins.rstudio.com/reference/board_connect_url.md) [`connect_auth_headers()`](https://pins.rstudio.com/reference/board_connect_url.md) : Use a vector of Posit Connect vanity URLs as a board - [`board_databricks()`](https://pins.rstudio.com/reference/board_databricks.md) : Use a Databricks Volume as a board - [`board_gcs()`](https://pins.rstudio.com/reference/board_gcs.md) : Use a Google Cloud Storage bucket as a board - [`board_gdrive()`](https://pins.rstudio.com/reference/board_gdrive.md) : Use a Google Drive folder as a board - [`board_folder()`](https://pins.rstudio.com/reference/board_folder.md) [`board_local()`](https://pins.rstudio.com/reference/board_folder.md) [`board_temp()`](https://pins.rstudio.com/reference/board_folder.md) : Use a local folder as board - [`board_ms365()`](https://pins.rstudio.com/reference/board_ms365.md) : Use a OneDrive or Sharepoint document library as a board - [`board_s3()`](https://pins.rstudio.com/reference/board_s3.md) : Use an S3 bucket as a board - [`board_url()`](https://pins.rstudio.com/reference/board_url.md) : Use a vector of URLs as a board ## Other functions - [`cache_browse()`](https://pins.rstudio.com/reference/cache_browse.md) [`cache_info()`](https://pins.rstudio.com/reference/cache_browse.md) [`cache_prune()`](https://pins.rstudio.com/reference/cache_browse.md) : Cache management - [`board_cache_path()`](https://pins.rstudio.com/reference/board_cache_path.md) : Retrieve default cache path - [`write_board_manifest()`](https://pins.rstudio.com/reference/write_board_manifest.md) : Write board manifest file to board's root directory # Articles ### All vignettes - [Create consistent metadata for pins](https://pins.rstudio.com/articles/customize-pins-metadata.md): - [Managing custom formats](https://pins.rstudio.com/articles/managing-custom-formats.md): - [Upgrading to pins 1.0.0](https://pins.rstudio.com/articles/pins-update.md): - [Get started with pins](https://pins.rstudio.com/articles/pins.md): - [Posit Connect](https://pins.rstudio.com/articles/posit-connect.md): - [Using web-hosted boards](https://pins.rstudio.com/articles/using-board-url.md):