Reputation: 21
I vaguely remember someone mentioning R startup settings that would do this at a course 2 years ago.
What I want is a log file of each R session, but I don't want to save commands that fail and the resulting error messages.
Upvotes: 2
Views: 535
Reputation: 49660
See the txtStart
function and friends in the TeachingDemos
package. These create a log of your session and optionally a file of just the commands. Currently only succesful commands are included (due to the way the task callback system currently works). Future versions may included the commands that cause errors, but an option or small modification will keep the current behavior.
Upvotes: 4
Reputation: 21532
Consider first that simply producing a list of successful commands is hardly the best thing to submit as "reproducible research." You're more than likely to have thrown in lots of 'extras' along the way, e.g., summary(My_Data)
or sd(My_Data$pumpkin.size)
, which aren't relevant to the actual sequence of analyses you want to present.
I would recomend you save the entire console log or history file. Then manually edit it to collect only the commands that are of interest, and put them into a stand-alone script file.
One final note: if in fact you're taking hundreds, or even dozens, of commands to complete your analysis, to use the LOLCATS language: "UR doin it RONG" . Write some functions, wrap them in scripts, and if necessary wrap the scripts in a "parent" script. This will make it much easier for you (or others) to reproduce exactly what you did.
Upvotes: 1