There seems to be little documentation about this (unless I’m looking in the wrong place!). I’m running R on the command line on Unix:
R --no-save < myfile1.r >& out1.txt
If I have several R scripts running simultaneously, do I have to put savehistory("history1.Rhistory") etc at the end of each file, or can the name of the .Rhistory file be given in the command line arguments?
I also assume that all warnings are saved in the R workspace; however, only the last 50 ever seem to be visible (There were 50 or more warnings (use warnings() to see the first 50)) – is there a way to save all warnings?
Nope. From
?warnings:Since then it has undocumentedly been stored in the variable
last.warninginbaseenv(), but don’t rely on that to always be the case. (Also note that that variable doesn’t exist if there hasn’t been a warning yet.) You are supposed to access the last warnings withwarnings()instead.Not obviously. The theory is that 50 warnings is plenty to worry about at once. Read the first 50, and fix the problems or wrap the offending code in
suppressWarningsif you think that the warning is erroneous, then deal with the next set.