Re: [R] History pruning

From: Richard M. Heiberger <>
Date: Fri, 01 Aug 2008 13:40:33 -0400

>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
>Ken Williams
>Research Scientist
>The Thomson Reuters Corporation
>Eagan, MN

No one has yet mentioned the obvious. ESS does your 5a 5b 5c with

   M-x ess-transcript-clean-buffer
It works in either the *R* buffer or a *.rt or *.st buffer. It handles multiple-line commands correctly.

Make sure the buffer is writable (C-x C-q on the *.rt buffer) M-x ess-transcript-clean-buffer
Save the buffer as a *.r file.

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

because I don't know what supersede means. I can imagine situations, for example,
plot(y ~ x)
x <- x + 1
plot(y ~ x)
where I want to keep both plots.
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. mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Fri 01 Aug 2008 - 17:50:31 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