[R] History pruning

From: Ken Williams <ken.williams_at_thomsonreuters.com>
Date: Wed, 30 Jul 2008 13:12:44 -0500


I find that a typical workflow for me looks something like this:

  1. import some data from files
  2. mess around with the data for a while
  3. mess around with plotting for a while
  4. get a plot or analysis that looks good
  5. go back through my history to make a list of the shortest command sequence to recreate the plot or analysis
  6. send out that sequence to colleagues, along with the generated plots or analysis output

I wonder if there are any tools people have developed to help with step 5. Typically I do something like this:

5a) save my entire history to a text file
5b) open it up in Emacs
5c) prune any lines that don't have assignment operators
5d) prune any plotting commands that were superseded by later plots

and then start on other more subtle stuff like pruning assignments that were later overwritten, unless the later assignments have variable overlap between the LHS and the RHS. Then I just start eyeballing it.

Would any deeper introspection of the history expressions be feasible, e.g. detecting statements that have no side effects, dead ends, etc.

The holy grail would be something like "show me all the statements that contributed to the current plot" or the like.


Ken Williams
Research Scientist
The Thomson Reuters Corporation
Eagan, MN

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 30 Jul 2008 - 18:46:57 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 08 Aug 2008 - 18:33:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive