| wrapStringAddin {xpectr} | R Documentation |
Wraps the selection with paste0
Description
Splits the selection every n characters
and inserts it in a paste0() call.
See `Details` for how to set a key command.
Usage
wrapStringAddin(
selection = NULL,
indentation = 0,
every_n = NULL,
tolerance = 10,
insert = TRUE
)
Arguments
selection |
String of code. (Character) N.B. Mainly intended for testing the addin programmatically. |
indentation |
Indentation of the selection. (Numeric) N.B. Mainly intended for testing the addin programmatically. |
every_n |
Number of characters per split. If
N.B. Strings shorter than |
tolerance |
Tolerance. Number of characters. We may prefer not to split a string that's only a few
characters too long. Strings shorter than |
insert |
Whether to insert the wrapped text via
N.B. Mainly intended for testing the addin programmatically. |
Details
How to set up a key command in RStudio
After installing the package. Go to:
Tools >> Addins >> Browse Addins >> Keyboard Shortcuts.
Find "Wrap String with paste0" and press its
field under Shortcut.
Press desired key command, e.g. Alt+P.
Press Apply.
Press Execute.
Value
Inserts the following (with newlines and correct indentation):
paste0("first n chars", "next n chars")
Returns NULL invisibly.
Author(s)
Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk
See Also
Other addins:
assertCollectionAddin(),
dputSelectedAddin(),
initializeGXSFunctionAddin(),
initializeTestthatAddin(),
insertExpectationsAddin(),
navigateTestFileAddin()