diff --git a/.Rbuildignore b/.Rbuildignore index 277748c..29b8d83 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -3,3 +3,6 @@ cran-comments.md ^\.travis\.yml$ ^codecov\.yml$ +^_pkgdown\.yml$ +^docs$ +^pkgdown$ diff --git a/_pkgdown.yml b/_pkgdown.yml new file mode 100644 index 0000000..ebefe92 --- /dev/null +++ b/_pkgdown.yml @@ -0,0 +1,41 @@ +destination: docs +reference: + - title: "Data pasting functions" + desc: > + The good stuff. All of these have RStudio addin bindings. + contents: + - tribble_paste + - vector_paste + - vector_paste_vertical + - df_paste + - dt_paste + - tile: "Data printing functions" + desc: > + analagous to 'dput' + contents: + - dpasta + - title: "Data formatting functions" + desc: > + Send data formatted as code to the clipboard instead of automatically pasting. + contents: + - tribble_format + - vector_format + - vector_format_vertical + - df_format + - dt_format + - title: "Data returning functions" + desc: > + Return data formatted as code as a character vector. + contents: + - tribble_construct + - vector_construct + - vector_construct_vertical + - dfdt_construct + - title: "Configuration functions" + desc: > + Change the behaviour of datapasta. + contents: + - dp_set_max_rows + - dp_set_decimal_mark + + diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 0000000..ef53605 --- /dev/null +++ b/docs/404.html @@ -0,0 +1,153 @@ + + + +
+ + + + +YEAR: 2017 +COPYRIGHT HOLDER: Miles McBain ++ +
vignettes/datapasta-in-the-cloud.Rmd
+ datapasta-in-the-cloud.Rmd
It is now possible to paste data as formatted code in RStudio Server/Cloud, and ssh sessions. (Thanks Garrick Aden-Buie and Jon Harmon!)
+There is no way to connect your local machine’s clipboard to the R session running on a cloud instance. So datapasta
cannot work as per local usage.
What has been developed instead are two kinds of fallback behaviour that capture most of the magic!
+If datapasta
detects the clipboard is not available and the editor is RStudio, it will check to see if there is a text selection active (highlighted text).
Given a selection, it will read that text instead of the clipboard and proceed as per the called function, e.g. attempt to parse that text as data and paste as a tribble
if tribble_paste
was called.
The imagined workflow here is:
+Again if there is no clipboard available, but in this case there is no text selected in RStudio (or you’re not in RStudio), datapasta
will open a temporary file and then call utils::file.edit()
on it.
In RStudio server/cloud this will pop-up a modal text editor window where text can be pasted. When the editor is closed, the text will be read by datapasta
and then things will proceed as if that data had come from the clipboard. The temporary file is deleted immediately after being read.
If you’re not in RStudio, but on the command line in an ssh session, this will open a command line text editor instead of the modal window.
+The workflow in this case is:
+vignettes/how-to-datapasta.Rmd
+ how-to-datapasta.Rmd
Datapasta provides RStudio addins and functions that give you complete freedom copy-paste data to and from your source editor, formatted for immediate use. Note: repeated use has been known to cause titilation and giddiness.
+Places I’ve found this power useful:
+dplyr::filter( .. %in% ..)
.c()
expressions with a LOT less typing and fiddling.Typical usage takes full advantage of addins within RStudio, however datapasta
can be used with any R editor, even just the terminal. The typical RStudio case is described in full detail below, followed by the fallback behaviour.
tribble_paste()
+You can copy this html table of Brisbane weather forecasts:
+X | +Location | +Min | +Max | +
---|---|---|---|
Partly cloudy. | +Brisbane | +19 | +29 | +
Partly cloudy. | +Brisbane Airport | +18 | +27 | +
Possible shower. | +Beaudesert | +15 | +30 | +
Partly cloudy. | +Chermside | +17 | +29 | +
Shower or two. Possible storm. | +Gatton | +15 | +32 | +
Possible shower. | +Ipswich | +15 | +30 | +
Partly cloudy. | +Logan Central | +18 | +29 | +
Mostly sunny. | +Manly | +20 | +26 | +
Partly cloudy. | +Mount Gravatt | +17 | +28 | +
Possible shower. | +Oxley | +17 | +30 | +
Partly cloudy. | +Redcliffe | +19 | +27 | +
And make this appear at the current cursor:
+tibble::tribble(
+ ~X, ~Location, ~Min, ~Max,
+ "Partly cloudy.", "Brisbane", 19L, 29L,
+ "Partly cloudy.", "Brisbane Airport", 18L, 27L,
+ "Possible shower.", "Beaudesert", 15L, 30L,
+ "Partly cloudy.", "Chermside", 17L, 29L,
+ "Shower or two. Possible storm.", "Gatton", 15L, 32L,
+ "Possible shower.", "Ipswich", 15L, 30L,
+ "Partly cloudy.", "Logan Central", 18L, 29L,
+ "Mostly sunny.", "Manly", 20L, 26L,
+ "Partly cloudy.", "Mount Gravatt", 17L, 28L,
+ "Possible shower.", "Oxley", 17L, 30L,
+ "Partly cloudy.", "Redcliffe", 19L, 27L
+ )
tibble::tribble()
or ‘transposed tibble’ is a really neat function that allows a tibble
to be written in human readable format (Thanks be to Hadley).
To paste data as a tribble()
call, just copy the table header and data rows, then paste into the source editor using the addin Paste as tribble
. For best results, assign the addin to a memorable keyboard shortcut, e.g. ctrl + shift + t
. See Customizing Keyboard Shortcuts.
tribble_paste()
is a flexible function that guesses the separator and types of the data it pulls from the clipboard. Mostly this seems to work well. Occasionally it epic-fails. The supported separators are \|
(pipe), \t
(tab), ,
(comma), ;
(semicolon). Most data copied from the internet or spreadsheets will be tab delimited. It will also attempt to recognise a lack of a header row and create a default for you, although this is not always possible.
vector_paste()
+A list could be a row or column of a spreadsheet or intermediate output. With the Paste as vector
addin you can go from something like:
Mint Fedora Debian Ubuntu OpenSUSE
+or
+Mint, Fedora, Debian, Ubuntu, OpenSUSE
+or
+Mint
+Fedora
+Debian
+Ubuntu
+OpenSUSE
+to
+ +This is pasted into the source editor at the current cursor.
+Just like tribble_paste()
, vector_paste()
has a flexible parser that can guess the type and separator of the data. The supported separators are \|
(pipe), \t
(tab), ,
(comma), ;
(semicolon) and end of line. The recommended keyboard shortcut is crtl + alt + shift + v
.
vector_paste_vertical()
+Given the same types of list inputs as above, the Paste as vector (vertical)
addin pastes the output with each element on its own line, e.g.:
This is much nicer for long lists. I have found this is actually the version I use more often. I recommend using ctrl + shift + v
as keyboard shortcut.
##Pasting as a data.frame with df_paste()
The parser here is identical to tribble_paste()
and has all the same type and separator guessing goodness. The difference is the output will be a formatted call to base::data.frame()
. Some sensible line wrapping rules etc are implemented. Useful for purists and educators alike. Special thanks to Jonathan Carroll for contributing this feature.
So the Brisbane weather table from above becomes:
+data.frame(
+ X = c("Partly cloudy.", "Partly cloudy.", "Possible shower.",
+ "Partly cloudy.", "Shower or two. Possible storm.",
+ "Possible shower.", "Partly cloudy.", "Mostly sunny.", "Partly cloudy.",
+ "Possible shower.", "Partly cloudy."),
+ Location = c("Brisbane", "Brisbane Airport", "Beaudesert", "Chermside",
+ "Gatton", "Ipswich", "Logan Central", "Manly",
+ "Mount Gravatt", "Oxley", "Redcliffe"),
+ Min = c(19, 18, 15, 17, 15, 15, 18, 20, 17, 17, 19),
+ Max = c(29, 27, 30, 29, 32, 30, 29, 26, 28, 30, 27)
+)
For a shortcut you could try ctrl + shift + d
.
dpasta()
+All of the above addin functions can be called directly with an R object argument. When run, this will result in the object being output at the current cursor. Usually the next line. To make things more magical, a there is a single function dpasta
that will match the argument with the appropriate _paste()
function based on its class. This means:
results in:
+data.frame(
+ Sepal.Length = c(5.1, 4.9, 4.7, 4.6, 5, 5.4),
+ Sepal.Width = c(3.5, 3, 3.2, 3.1, 3.6, 3.9),
+ Petal.Length = c(1.4, 1.4, 1.3, 1.5, 1.4, 1.7),
+ Petal.Width = c(0.2, 0.2, 0.2, 0.2, 0.2, 0.4),
+ Species = as.factor(c("setosa", "setosa", "setosa", "setosa", "setosa",
+ "setosa"))
+ )
while:
+ +will give you:
+tibble::tribble(
+ ~manufacturer, ~model, ~displ, ~year, ~cyl, ~trans, ~drv, ~cty, ~hwy, ~fl,
+ "audi", "a4", 1.8, 1999L, 4L, "auto(l5)", "f", 18L, 29L, "p",
+ "audi", "a4", 1.8, 1999L, 4L, "manual(m5)", "f", 21L, 29L, "p",
+ "audi", "a4", 2, 2008L, 4L, "manual(m6)", "f", 20L, 31L, "p",
+ "audi", "a4", 2, 2008L, 4L, "auto(av)", "f", 21L, 30L, "p",
+ "audi", "a4", 2.8, 1999L, 6L, "auto(l5)", "f", 16L, 26L, "p",
+ "audi", "a4", 2.8, 1999L, 6L, "manual(m5)", "f", 18L, 26L, "p"
+ )
There are two addins that operate on RStudio cursor selections to make your life easier:
+Fiddle Selection
is intended to remove some fiddly tasks from your workflow. It can turn raw data like 1 2 3
into c(1,2,3)
, then pivot from that to:
c(1,
+ 2,
+ 3)
+and back again to c(1,2,3)
. The parser here is really flexible too. It will accept data delimited by any combination of spaces, commas, and newlines.
Fiddle Selection
Can also reflow messy tribble()
and data.frame()
expressions into neatly aligned ones, say after hand editing.
Toggle Vector Quotes
will convert a selected expression like c(a,b,c)
to a quoted version i.e c("a","b","c")
. If it’s already quoted it will convert the other way to a bare version. All elements will be quoted if there’s a mixture. It also works with vertically algined expressions.
With the combination of these two you can get really lazy e.g. go from:
+some stuff I typed
+
+#To
+
+c("some",
+ "stuff",
+ "I",
+ "typed") # mostly
+
+in a couple of keystrokes!
+Try assigning these addins to ctrl + shift + f
and ctrl + shift + q
respectively.
dmdclip()
+dmdclip()
can help you take the data to somewhere that uses markdown format, for example a Stack Overflow question or Github issue. This function will copy the resulting formatted data object call to the clipboard, inserting 4 spaces at the head of each line, which is markdown syntax for a pre-formatted block.
So:
+ +Will paste the following on the clipboard:
+ data.frame(
+ Sepal.Length = c(5.1, 4.9, 4.7, 4.6, 5, 5.4),
+ Sepal.Width = c(3.5, 3, 3.2, 3.1, 3.6, 3.9),
+ Petal.Length = c(1.4, 1.4, 1.3, 1.5, 1.4, 1.7),
+ Petal.Width = c(0.2, 0.2, 0.2, 0.2, 0.2, 0.4),
+ Species = as.factor(c("setosa", "setosa", "setosa", "setosa", "setosa",
+ "setosa"))
+ )
+The rstudioapi
package enables the calling of addins and output to the cursor. If the API is not detected, all the _paste()
functions, and dpasta
will output their text to the console, ready for copying and pasting to an editor window.
In this scenario you may wish to avoid installation of the rstudioapi
package dependency. Use install.packages("datapasta", dependencies = "Depends")
to avoid API installation, but be sure to follow up with install.packages(c("readr","clipr"))
.
note: The dpasta()
function can be used without clipr
installed, but you’re missing out on a fair amount of awesomeness if you limit yourself to that.
Custom behaviour can be created by taking advantage of the _construct()
variants of the _paste()
functions, as these return their output as an R object which can then be written to an appropriate buffer or clipboard.
for example, if you copied the Brisbane weather forecast from above to the clipboard and then called:
+ +trib_call
now contains a the tribble call as a character vector. You could then write this with:
For your protection, datapasta
will initially refuse to output R objects of 200 or more rows. Up the row limit for your specific scenario with dp_set_max_rows(n)
. Large numbers of rows could take a long time to format. In extreme cases you could crash your R/RStudio session.
Use dp_set_decimal_mark(",")
to handle numbers like 3,14
.
datapasta
is about reducing resistance associated with copying and pasting data to and from R. It is a response to the realisation that I often found myself using intermediate programs like Sublime to munge text into suitable formats. Addins and functions in datapasta
support a wide variety of input and output situations, so it (probably) “just works”. Hopefully tools in this package will remove such intermediate steps and associated frustrations from our data slinging workflows.
xsel
or xclip
. These applications provide an interface to X selections (clipboard-like).
+sudo apt-get install xsel
- it’s 72kb…install.packages("datapasta")
+At the moment this package contains these RStudio addins that paste data to the cursor:
+tribble_paste
which pastes a table as a nicely formatted call to tibble::tribble()
+vector_paste
which will paste delimited data as a vector definition, e.g. c("a", "b")
etc.
+vector_paste_vertical
which will paste delimited data as a vertically formatted vector definition.
+c("Mint",
+"Fedora",
+"Debian",
+"Ubuntu",
+"OpenSUSE")
+df_paste
which pastes a table on the clipboard as a standard data.frame
definition rather than a tribble
call. This has certain advantages in the context of reproducible examples and educational posts. Many thanks to Jonathan Carroll for getting this rolling and coding the bulk of the feature.
+dt_paste
which is the same as df_paste
, but for data.table
.There are two Addins that can help with creating and aliging data in your editor:
+Fiddle Selection
will perform magic on a selection. It can be used to:
+c()
expressionc()
expr between horizontal and vertical layout.tribble()
and data.frame()
exprs.Toggle Vector Quotes
will toggle a c()
expr between all elements wrapped in ""
and all bare unquoted form. Handy in combination with above to save mucho keystrokes.
+There are two R functions available that accept R objects and output formatted text for pasting to a reprex or other application:
+dpasta
accepts tibbles, data.frames, and vectors. Data is output in a format that matches in input class. Formatted text is pasted at the cursor.
dmdclip
accepts the same inputs as dpasta
but inserts the formatted text onto the clipboard, preceded by 4 spaces so that is can be as pasted as a preformatted block to Github, Stackoverflow etc.
The only hard dependency of datapasta
is readr
for type guessing. All the above *paste
functions can be called directly instead of as an addin, and will fall back to console output if the rstudioapi
is not available.
On system without access to the clipboard (or without clipr
installed) datapasta
can still be used to output R objects from an R session. dpasta
is probably the only function you care about in this scenario.
datapasta
imports clipr
and rstudioapi
so as to make installation smooth and easy for most users. If you wish to avoid installing an rstudioapi
you will never use you can use:
install.packages("datapasta", dependencies = "Depends")
.install.packages("clipr")
to enable clipboard features.tribble_paste
works well with CSVs, 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. :(tribble_paste()
/dpasta()
. Nested lists of length 1 fail unless all are length 1 - It’s complicated. You still get some output so it might be viable to fix and reflow with Fiddle Selection
. Tread with caution.This package is made possible by mdlincon’s 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.
NEWS.md
+ _format
functionsdt_paste
function for pasting as data.table
(Thanks @jonocarroll, #72, closes #70)dpasta()
will now handle tribbles with R classes that cannot be represented in tribble form. It falls back to their character representation. This works well for things like dates.c()
expressions from raw data, and pivot c()
exprs between vertical and horizontal format.c()
expr, it will toggle all elements between quoted and bare format.dmdclip()
- Why would you?. Tests containing clipboard use are skipped on CI and CRAN.dpasta
. The clipboard is not involved.dmdclip
._construct()
functions that return the formatted output as an R character vector.dp_set_decimal_mark
.df_paste()
which pastes a table from the clipboard using a nicely formatted call to data.frame()
rather than tribble()
+tribble_paste()
and 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.md
file to track changes to the package.tribble_paste()
+the _context functions define lists of parameters for text formatting. +The specific contexts return hard-coded values appropriate to the context they describe, while custom_context allows definition of new contexts for custom formatting.
+clipboard_context() + +rstudio_context() + +console_context() + +markdown_context() + +custom_context( + output_mode = "console", + nspc = 2, + indent_context = 0, + indent_head = TRUE +)+ +
output_mode | +A named output mode, controls the target of the _paste functions options are "rstudioapi" or "console" |
+
---|---|
nspc | +The number of spaces for each indent level in the output context |
+
indent_context | +The number of spaces applied initially to all lines in the output context |
+
indent_head | +Logical. Apply the indent_context to the to the header row? Use FALSE if targeting cursor location. |
+
an output context. An input to _paste, _format, _construct functions used to format whitespace.
+ +Parse the current clipboard as a table and paste to the clipboard in data.frame format.
+df_format(input_table, output_context = clipboard_context())+ +
input_table | +an optional input tibble or data.frame to format. |
+
---|---|
output_context | +an optional output context that defines the target and indentation. |
+
nothing.
+ +Parse either: the current clipboard, or a supplied argument, as a table and paste in at the cursor location in data.frame format.
+df_paste(input_table, output_context = guess_output_context())+ +
input_table | +an optional input tibble or data.frame to format. |
+
---|---|
output_context | +an optional output context that defines the target and indentation. +The default behaviour is target the rstudioapi and fall back to console if it is not available. |
+
nothing.
+ +Parse the current clipboard as a table and return in data.frame format.
+dfdt_construct(input_table, oc = console_context(), class = NULL)+ +
input_table | +an optional R object to parse instead of the clipboard. |
+
---|---|
oc | +an optional output context that defines the target and indentation. |
+
class | +either data.frame or data.table. |
+
a character string containing the input formatted as a data.frame definition.
+ +A function to optionally set the decimal mark if in a locale where it is not `.`. Will allow "3,14" to be parsed as 3.14, normally would be parsed as 314. +Will also handle spaces in numbers.
+dp_set_decimal_mark(mark)+ +
mark | +The decimal mark to use when parsing "number" type data, as guessed by readr::guess_parser. |
+
---|
NULL.
+ +Parse the current clipboard as a table and paste to the clipboard in data.table format.
+dt_format(input_table, output_context = clipboard_context())+ +
input_table | +an optional input tibble or data.frame to format. |
+
---|---|
output_context | +an optional output context that defines the target and indentation. |
+
nothing.
+ +Parse either: the current clipboard, or a supplied argument, as a table and paste in at the cursor location in data.table format.
+dt_paste(input_table, output_context = guess_output_context())+ +
input_table | +an optional input tibble or data.frame to format. |
+
---|---|
output_context | +an optional output context that defines the target and indentation. +The default behaviour is target the rstudioapi and fall back to console if it is not available. |
+
nothing.
+ +Guesses the separator based on a simple heuristic over the first 10 or less rows: +The separator chosen is the one that leads to the most columns, whilst parsing the same number of columns for each line (var=0). +The guessing algorithm ignores blank lines - which are lines that contain only the separator. +Options are in `c(",","\t","\|",";")`
+guess_sep(char_vec)+ +
char_vec | +a table from the clipboard in character vector form. |
+
---|
the separator selected to parse char_vec as a table
+ +Pastes data from clipboard as a vertically formatted character vector on +multiple lines. One line is used per element. Considers `,`, `tab`, `newline` as delimiters.
+parse_vector(input_vector)+ +
input_vector | +an optional character vector to attempt to break up, and escape. |
+
---|
A vector parsed from the clipboard as ether a character string or a +character vector. The type attribute contains the type guessed by `readr`.
+ +Similar to read_clip_tbl from clipr, +however it will error if there are less than 2 rows +and it tries to guess the separator.
+read_clip_tbl_guess(x = NULL, ...)+ +
x | +contents of the clipboard |
+
---|---|
... | +arguments passed to read.table |
+
a parsed table from the clipboard. Separator is guessed.
+ +Renders a character vector as R types for pasting into Rstudio. +Strings are quoted. Numbers, NA, logicals etc are not.
+render_type(char_vec, char_type)+ +
char_vec | +a character vector containing text to be rendered as the type indicated by type_str |
+
---|---|
char_type | +a string describing the type of char_vec |
+
A vector parsed from the clipboard as ether a character string or a +character vector. The type attribute contains the type guessed by `readr`.
+ +Based on a type and length, render a character string as the type in text. +Pad to the desired length.
+render_type_pad_to(char_vec, char_type, char_length)+ +
char_vec | +a character vector |
+
---|---|
char_type | +a string type from readr::guess_parser |
+
char_length | +a string length to pad to. |
+
a string containing the representation of char_vec as char_type in the RStudio source editor, +left-padded with spaces to char_length.
+ +wrap the datapasta around itself
+tortellini(col_struct, defn_width = 80, indent_context = 0, add_comma = TRUE)+ +
col_struct | +input structure - a split apart column definition |
+
---|---|
defn_width | +total number of characters in a line (includes column name and indent on line 1) |
+
indent_context | +the level of indent in spaces in the current editor pane |
+
add_comma | +add one final comma to the end of the wrapped column def? Useful when pasting together columns. |
+
w wrapped string
+ +Parse the current clipboard as a table, or use the table argument supplied, and return as a character string.
+tribble_construct(input_table, oc = console_context())+ +
input_table | +an optional input `data.frame`. If `input_table` is supplied, then nothing is read from the clipboard. |
+
---|---|
oc | +an optional output context that defines the target and indentation. Default is console. +Table is output as `tribble()` call. Useful for creating reproducible examples. |
+
The parsed table text.
+ +Parse the current clipboard as a table, or use the table argument supplied, and paste to the clipboard in tribble format.
+tribble_format(input_table, output_context = console_context())+ +
input_table | +an optional input `data.frame`. If `input_table` is supplied, then nothing is read from the clipboard. |
+
---|---|
output_context | +an optional output context that defines the target and indentation. Default is console. +Table is output as `tribble()` call. Useful for creating reproducible examples. |
+
Nothing.
+ +Parse the current clipboard as a table, or use the table argument supplied, and paste in at the cursor location in tribble format.
+tribble_paste(input_table, output_context = guess_output_context())+ +
input_table | +an optional input `data.frame`. If `input_table` is supplied, then nothing is read from the clipboard. |
+
---|---|
output_context | +an optional output context that defines the target and indentation. Default is to guess between rstudio and console. +Table is output as `tribble()` call. Useful for creating reproducible examples. |
+
Nothing.
+ +Returns a formatted character string, either from clipboard or supplied argument, as a vector definition. Considers `,`, `tab`, `newline` as delimiters. +If a single character string is passed as an argument, it will be split to form a vector.
+vector_construct(input_vector, oc = console_context())+ +
input_vector | +An input vector to be formatted for output. If supplied, no data is read from the clipboard. |
+
---|---|
oc | +an optional output context that defines the output indentation. |
+
A string containing the input formatted as a vector definition.
+ +Returns a formatted string, either from clipboard or supplied argument, as a vertically formatted character vector over many lines. +Considers `,`, `tab`, `newline` as delimiters. If a single character string is passed as an argument, it will be split to form a vector.
+vector_construct_vertical(input_vector, oc = console_context())+ +
input_vector | +An input vector to be formatted for output. If supplied, no data is read from the clipboard. |
+
---|---|
oc | +an optional output context that defines the output target and indentation. +The default behaviour is to target the rstudioapi and fall back to console if it is not available. |
+
a string containing the input formatted as a vector definition.
+ +Writes data to the clipboard, either from clipboard or supplied argument. Writes a horizontally formatted character vector on +a single line. Considers `,`, `tab`, `newline` as delimiters. If a single character string is passed as an argument, it will be split to form a vector.
+vector_format(input_vector, output_context = console_context())+ +
input_vector | +An input vector to be formatted for output. If supplied, no data is read from the clipboard. |
+
---|---|
output_context | +an optional output context that defines the output indentation. |
+
nothing.
+ +Writes data to clipboard, either from clipboard or supplied argument, as a vertically formatted character vector over many lines. +Considers `,`, `tab`, `newline` as delimiters. If a single character string is passed as an argument, it will be split to form a vector.
+vector_format_vertical(input_vector, output_context = clipboard_context())+ +
input_vector | +An input vector to be formatted for output. If supplied, no data is read from the clipboard. |
+
---|---|
output_context | +an optional output context that defines the output target and indentation. +The default behaviour is to target the rstudioapi and fall back to console if it is not available. |
+
nothing.
+ +Pastes data, either from clipboard or supplied argument, as a horizontally formatted character vector on +a single line. Considers `,`, `tab`, `newline` as delimiters. If a single character string is passed as an argument, it will be split to form a vector.
+vector_paste(input_vector, output_context = guess_output_context())+ +
input_vector | +An input vector to be formatted for output. If supplied, no data is read from the clipboard. |
+
---|---|
output_context | +an optional output context that defines the output target and indentation. +The default behaviour is to target the rstudioapi and fall back to console if it is not available. |
+
nothing.
+ +Pastes data, either from clipboard or supplied argument, as a vertically formatted character vector over many lines. Considers `,`, `tab`, `newline` as delimiters. If a single character string is passed as an argument, it will be split to form a vector.
+vector_paste_vertical(input_vector, output_context = guess_output_context())+ +
input_vector | +An input vector to be formatted for output. If supplied, no data is read from the clipboard. |
+
---|---|
output_context | +an optional output context that defines the output target and indentation. +The default behaviour is to target the rstudioapi and fall back to console if it is not available. |
+
nothing.
+ +An addin to fiddle your RStudio selections to better things. +Make a selection in RStudio and dfiddle will update it inline. Good for: +Converting Text to vectors (`c()`), pivoting between horizontal and vertical vectors, +reflowing tribble() and data.frame() definitions to have nice indenting and padding.
+zzz_rs_dfiddle()
+
+
+ a fiddled version of your selection (invisibly)
+ +