The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

m.dr (70) [Avatar] Offline
#1
I am trying to run a R script and show results in cmd window.

So In using R CMD BATCH fileName.R /dev/tty which works fine ...

Its understandable that the libraries are loaded every time a file is run which is time-consuming.

So to avoid loading the libraries every time I run R and source(fileName.R).
Which runs the fileName.R script but does not show any output on screen.

But there seems to be no way to do a sink(/dev/tty) or such so that when I do a source(fileName.R) the output shows up (on screen) including plots ... and solves the dilemma of having to load the libraries each time.

I am assuming there is as I found the way to just show output from R CMD BATCH and not echo the script, but cant seem to find a way to:

- run the script AND
- not have to load libraries every time AND
- show outputs on terminal.

Thanks for your help.
m.dr (70) [Avatar] Offline
#2
Re: running R files
Thanks - I got this sorted out.
I needed to use the print cmd!
staran (8) [Avatar] Offline
#3
Re: running R files
Do you mind sharing what you did to resolve the problem? Thanks a lot.
-sanjeev