GithubHelp home page GithubHelp logo

isabella232 / pins Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rstudio/pins-r

0.0 0.0 0.0 30.19 MB

Pin, Discover and Share Resources

Home Page: https://pins.rstudio.com

License: Other

Shell 0.01% JavaScript 17.88% R 80.78% CSS 0.83% HTML 0.50%

pins's Introduction

pins

R-CMD-check CRAN Status Codecov test coverage

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), RStudio Connect, Amazon S3, 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.

pins 1.0.0 includes a new more explicit API and greater support for versioning. The legacy API (pin(), pin_get(), and board_register()) will continue to work, but new features will only be implemented with the new API, so we encourage you to switch to the modern API as quickly as possible. Learn more in vignette("pins-update").

Installation

To try out the development version of pins (which will become pins 1.0.0 when released), you’ll need to install from GitHub:

remotes::install_github("rstudio/pins")

If you discover this breaks any of your existing code, please let us know then revert to the released version:

install.packages("pins")

Usage

To use the pins package, you must first create a pin board. A good place to start is board_folder(), which stores pins in a directory you specify. Here I’ll use a special version of board_folder() called board_temp() 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!

library(pins)

board <- board_temp()
board
#> Pin board <pins_board_folder>
#> Path: '/tmp/RtmpAYa45m/pins-6cce258ca9cf'
#> Cache size: 0

You can “pin” (save) data to a board with pin_write(). It takes three arguments: the board to pin to, an object, and a name:

board %>% pin_write(head(mtcars), "mtcars")
#> Guessing `type = 'rds'`
#> Creating new version '20211116T161305Z-e8160'
#> 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 csv, json, or arrow file.

You can later retrieve the pinned data with pin_read():

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() with a directory on a shared drive or in dropbox, or if you use RStudio Connect you can use board_rsconnect():

board <- board_rsconnect()
#> Connecting to RSC 1.9.0.1 at <https://connect.rstudioservices.com>
board %>% pin_write(tidy_sales_data, "sales-summary", type = "rds")
#> Writing to pin 'hadley/sales-summary'

Then, someone else (or an automated Rmd report) can read and use your pin:

board <- board_rsconnect()
board %>% pin_read("hadley/sales-summary")

You can easily control who gets to access the data using the RStudio Connect permissions pane.

The pins package also includes boards that allow you to share data on services like Amazon’s S3 (board_s3()), Azure’s blob storage (board_azure()), and Microsoft SharePoint (board_ms365()). Learn more in vignette("pins").

pins's People

Contributors

javierluraschi avatar hadley avatar kevinykuo avatar salim-b avatar hongooi73 avatar jduckles avatar sellorm avatar colearendt avatar smingerson avatar gshotwell avatar edavidaja avatar kellobri avatar wurli avatar atusy avatar yue-jiang avatar jthomasmock avatar chronofanz avatar ojziff avatar duju211 avatar juliasilge avatar jonkeane avatar jcheng5 avatar blairj09 avatar indrajeetpatil avatar espinielli avatar dfalbel avatar cderv avatar carlosdavila91 avatar 1beb avatar aronatkins avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.