dputSelectedAddin {xpectr} | R Documentation |
Replaces selected code with its dput() output
Description
RStudio Addin:
Runs dput()
on the selected code and inserts
it instead of the selection.
See `Details`
for how to set a key command.
Usage
dputSelectedAddin(selection = NULL, insert = TRUE, indentation = 0)
Arguments
selection |
String of code. (Character) E.g. N.B. Mainly intended for testing the addin programmatically. |
insert |
Whether to insert the expectations via
N.B. Mainly intended for testing the addin programmatically. |
indentation |
Indentation of the selection. (Numeric) N.B. Mainly intended for testing the addin programmatically. |
Details
How
Parses and evaluates the selected code string,
applies dput()
and
inserts the output instead of the selection.
How to set up a key command in RStudio
After installing the package. Go to:
Tools >> Addins >> Browse Addins >> Keyboard Shortcuts
.
Find "dput() Selected"
and press its field under Shortcut
.
Press desired key command, e.g. Alt+D
.
Press Apply
.
Press Execute
.
Value
Inserts the output of running
dput()
on the selected code.
Does not return anything.
Author(s)
Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk
See Also
Other addins:
assertCollectionAddin()
,
initializeGXSFunctionAddin()
,
initializeTestthatAddin()
,
insertExpectationsAddin()
,
navigateTestFileAddin()
,
wrapStringAddin()