[R] History pruning
Ken Williams
ken.williams at thomsonreuters.com
Fri Aug 1 19:50:24 CEST 2008
On 8/1/08 12:40 PM, "Richard M. Heiberger" <rmh at temple.edu> 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
More information about the R-help
mailing list