Send code to the R console and optionally execute it.

sendToConsole(code, execute = TRUE, echo = TRUE, focus = TRUE)

Arguments

code

Character vector containing code to be executed.

execute

Boolean; execute the code immediately or just enter the text into the console?

echo

Boolean; echo the R code in the console as it's executed?

focus

Boolean; focus the R console after sending code?

Note

The sendToConsole function was added in version 0.99.787 of RStudio.

Examples

if (FALSE) { rstudioapi::sendToConsole(".Platform", execute = TRUE) }