Jacob,

As far as I am aware, the OSX GUI has no logging/transcript feature per se, short of saving the console output to an external file.

The history file will, as you note, only contain the commands entered at the R prompt, not the additional output.

One of the solutions would be to use an external editor, which supports running an R session in such a fashion as to have the console output directed to a buffer or frame within the editor, which then itself can just be saved to a file.

There are a fair number of such options, but ESS (Emacs Speaks Statistics) is common and the one that I have used for a number of years, on Windows, then Linux and now OSX. ESS allows you to run an R session within Emacs and thus be able to save the entire R buffer to a file for future reference. Thus, you can have a complete transcript of the session.

HTH,

Marc Schwartz



On Aug 3, 2009, at 3:38 PM, Jacob Wegelin wrote:

Maybe I'm missing something in the history help file. I read it and
subsequently tried

savehistory("trythis.txt")

but the resulting file does not contain the text that scrolled past
the console. It contains only a few uninteresting timestamps. Is
there some more useful application of history() or savehistory()?

On Mon, Aug 3, 2009 at 4:09 PM, roger koenker <rkoen...@uiuc.edu> wrote:

have you read

      ?history


url:    www.econ.uiuc.edu/~roger            Roger Koenker
email    rkoen...@uiuc.edu            Department of Economics
vox:     217-333-4558                University of Illinois
fax:       217-244-6678                Urbana, IL 61801




On Aug 3, 2009, at 3:01 PM, Jacob Wegelin wrote:

Consider all the text that one sees on the console during an R session.

Is there a way, within R, that all this text--i.e., both the "output" and the "messages"--can be automatically copied to a single file, in addition
to
its being visible on the console?

If I remember to save the console to a file at the end of my R session,
that
does it. But

(1) That requires pointing and clicking--can it be automated as a text
command?

(2) It would be nice to issue the text command at the start of the R
session, such as "log this entire session in mylog.txt, append", to ensure that the session is logged whether I remember to save the console or not.

As far as I can tell,

sink(file="mylog.txt")

will hide the output from me and put it into mylog.txt. But it still shows
me the error messages.

An attempt to put the output and messages into separate files returns an
error:

sink("junkout.txt", type="output")
sink("junkmsg.txt", type="message")

Error in sink("junkmsg.txt", type = "message") :
'file' must be NULL or an already open connection

and at any rate I'd like both messages in the same file, just like on the
console.

People who run R at the unix command line apparently use the unix command
-script-. But I mean something that will work within R,
platform-independent.

A 2003 post to R-help suggests savehistory(), but this does *not* save the console; I tried it just now. Another post from the same thread suggests
using emacs. But that is not platform-independent.

The existence of the 2003 thread suggests that this issue comes up
periodically. Was it a deliberate design decision not to make logs
available, in contrast to the way logging works in Stata?

I use the Rgui on a MacBook Pro:

sessionInfo()

R version 2.8.1 (2008-12-22)
i386-apple-darwin8.11.1

locale:
en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] lme4_0.999375-28   Matrix_0.999375-21 lattice_0.17-17
foreign_0.8-29

loaded via a namespace (and not attached):
[1] boot_1.2-34 grid_2.8.1


Thanks for any insights.

Jacob A. Wegelin
Assistant Professor
Department of Biostatistics
Virginia Commonwealth University
730 East Broad Street Room 3006
P. O. Box 980032
Richmond VA 23298-0032
U.S.A.
E-mail: jwege...@vcu.edu
URL: http://www.people.vcu.edu/~jwegelin

      [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to