At the moment I have a very simple script. If I type the commands into a console, I have text printing to the screen. However if I run the script using the following
source('myscript.R')
The contents are executed but nothing is printed to the screen. How do I stop console output from being suppressed?
In this article, we are going to discuss how to suppress the output of a command in R programming language. Suppressing means making the output invisible. We can make the output should not appear. By using invisible() function we can suppress the output.
Ctrl + Enter – Runs the current line and jumps to the next one, or runs the selected part without jumping further. Alt + Enter – Allows running code without moving the cursor to the next line if you want to run one line of code multiple times without selecting it. Ctrl + Alt + R – Runs the entire script.
IMHO you need to specify print.eval
parameter set to TRUE
if you want to get only the output (and not the commands). If you would need the commands too, you should set echo
to TRUE
(which implies setting print.eval
to TRUE
).
For example:
source('myscript.R', print.eval = TRUE)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With