https://github.com/MilesMcBain/portal
move data between R processes
https://github.com/MilesMcBain/portal
Last synced: 4 months ago
JSON representation
move data between R processes
- Host: GitHub
- URL: https://github.com/MilesMcBain/portal
- Owner: MilesMcBain
- License: other
- Created: 2021-05-31T06:27:14.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-01-10T10:25:41.000Z (over 3 years ago)
- Last Synced: 2024-11-30T20:52:54.778Z (4 months ago)
- Language: R
- Size: 11.7 KB
- Stars: 35
- Watchers: 4
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - MilesMcBain/portal - move data between R processes (R)
README
# portal
Move R datasets between local sessions.
## Installation
You can install the development version of portal from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("milesmcbain/portal")
```## Usage
You discovered a problem in your pipeline. You've isolated the data but the code
that's blowing up lives in one of your packages. You fire up the package project
and prepare to get cracking... but geez wouldn't it be nice if you could just
pull that dataset from your pipeline, directly into your package REPL?I mean reprexes are nice and all... but a dataset that creates the issue is right there...
## Pipeline R session
```R
❯ breaking_dataset |> portal::push()# __
# | |---
# | |
# breaking_dataset -> | |
# | |
# |__|---```
## Package session
```R
❯ portal::pull()
# __
# ---| |
# | |
# | | -> breaking_dataset
# | |
# ---|__|```
`breaking_dataset` is now in the global environment. Let's get fixing!
## Advanced usage
By default datasets are serialised using Rds. If that's too slow `push` takes a `serialiser` argument which can be set as an option: `portal.serialser`. Supported choices are in `c("rds", "qs", "parquet")`.
## Problems
`push()` uses the name of the symbol you passed in to name the file, which in
turn informs `pull` what to call the object when it is imported. Weird object
names won't work that well. Notably if you use this with the `{magrittr}` pipe
you'll have a bad time, since the symbol (and file) will be named `.`.Similarly pushing unnamed expressions might result in invalid file names and so won't work.
I'll probably fix these eventually. Contributions are welcome.