RStudio addins and R functions that make copy-pasting vectors and tables to text painless.
datapasta is about reducing resistance associated with copying and pasting data into R Studio. It is a response to the realisation that I often found myself using Sublime as an intermediate text munging step when copying data. Hopefully addins in this package will remove such intermediate steps from our copy-pasta workflows.
At the moment this package contains functional versions of these R Studio addins:
tribble_paste()which pastes a table on the clipboard as a nicely formatted call to
ctrl + shift + tas shortcut.
vector_paste()which will paste delimited data as a vector definition, e.g.
ctrl + alt + shift + vas shortcut.
vector_paste_vertical()which will paste delimited data as a vertically formatted vector definition.
ctrl + shift + vas shortcut
tribble_pasteworks well with csv's, excel files, and html tables, but is currently brittle with respect to irregular table structures like merged cells or multi-line column headings. For some reason Wikipedia seems chock full of these. :(
xclip. These applications provide an interface to X selections (clipboard-like).
sudo apt-get install xsel- it's 72kb...
This package is made possible by [mdlincon's clipr](https://github.com/mdlincoln/clipr, and Hadley's packages tibble and readr (for data-type guessing). I especially appreciate
clipr's thoughtful approach to the clipboard on Linux, which pretty much every other R clipboard package just nope'd out on.
#Future developments I'm looking at ways to address the pitfalls. The next thing I will look at is some kind of support on RStudio server, since I use this often myself. Feel free to contribute your ideas for solving these problems to the open issues.
vector_paste()now pastse NA's as unquoted, so R will parse as propper NA.
tribble_paste()can parse an paste table text copied from raw delimited file e.g. csv, tsv, pipe delimited, seimi-colon delimited.
vector_paste()uses a space between elements.
NEWS.mdfile to track changes to the package.