3

Is there a way to fully log (stdin, stdout, stderror) a R session executed via Rscript in batch mode?

I know, that I can use R CMD BATCH to log the full session of a batch job. I also know how to write errors and output into a logfile using Rscript but since it is often said that R CMD BATCH is a relict from the old days and one should use Rscript, I was wondering if it can also log everything.

I suppose it is impossible but I am not sure - neither do I know why.

petermeissner
  • 12,234
  • 5
  • 63
  • 63
  • Did you try `Rscript --save`? – agstudy Feb 03 '14 at 19:57
  • @agstudy This saves the workspace but it does not log anything -- right. – petermeissner Feb 03 '14 at 20:29
  • how about `-e "sink('logfile.txt')"` ? – Ricardo Saporta Feb 04 '14 at 03:57
  • nope, that doesnt do anything except creating 'logfile.txt' ... I tried: ``Rscript -e "sink('logfile.txt')" getQuotes.r`` – petermeissner Feb 04 '14 at 09:10
  • There is this answer here: http://stackoverflow.com/questions/14008139/capturing-rscript-errors-in-an-output-file which tells you how to log stdout and stderror. So to answer the question do we just need to log stdin? – Alex Dec 08 '14 at 23:15
  • 1
    **YES, Why not?** ... I want to see where the errors happened what ran through and what might have given a warning or whatever. Separating might be nice sometimes but having all three in one file is neat most of the times when human instead of machine has to look at the stuff. – petermeissner Dec 09 '14 at 04:55

0 Answers0