[R] History pruning
Richard M. Heiberger
rmh at temple.edu
Fri Aug 1 19:40:33 CEST 2008
>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,
par(mfrow=c(1,2))
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.
More information about the R-help
mailing list