Re: [R] History pruning

From: Ken Williams <>
Date: Fri, 01 Aug 2008 12:50:24 -0500

On 8/1/08 12:40 PM, "Richard M. Heiberger" <> wrote:

>> 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
> No one has yet mentioned the obvious. ESS does your 5a 5b 5c with
> M-x ess-transcript-clean-buffer

I think you mean just 5a & 5b, right? Lines with syntax errors are (I think) removed, but that's it.

That part is relatively easy to perform as the first step of a tool, just by running commands through R's parse() and discarding anything that throws an exception.

> On automatic content analysis, that is tougher. I would be scared to do your
>> 5d) prune any plotting commands that were superseded by later plots

True. There are lots of (perhaps relatively common) edge cases that would have to be taken into account. Perhaps a more interactive approach would be better, something like "get rid of this plot command and all subsequent modifications to its canvas". Not sure.

My basic philosophy on stuff like this is, given the choice of me fumbling around using tools and me fumbling around without using tools, I tend to do better when I have tools.

> You also have to trust that there are no side effects, which I wouldn't
> want to do, because plot() changes the value of par() parameters.

It does? I wasn't aware of that, could you give an example?

Ken Williams
Research Scientist
The Thomson Reuters Corporation
Eagan, MN

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 01 Aug 2008 - 18:11:49 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 01 Aug 2008 - 18:33:07 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive