[R] Equivalent of log file in R?

Ista Zahn izahn at psych.rochester.edu
Mon Feb 21 20:45:48 CET 2011


Hi Tatyana,
Well, most things are implicitly printed. For the most part you should
be able to just

sink(file="my_R_log.txt")

and write your r-code as you normally would. Anything that would
usually be printed to the screen is instead sent to my_R_log.txt
instead, including things that are implicitly printed.

Note that you should do

sink()

when done to close the connection. Just give it a try and see if it
does what you want. If not report back and tell us what you want that
sink() is not doing for you.

Best,
Ista

On Mon, Feb 21, 2011 at 6:26 PM, Tatyana Deryugina <tatyanad at mit.edu> wrote:
> Thanks, Ista! I looked at sink() and it looks like it might work.
> However, it seems as though you need to use it with the "print"
> command. I have a lot of regression output that I would like to store
> in a log file. How do I use sink with that?
>
> Best,
> Tatyana
> ---------------------------------------------------------------
> Tatyana Deryugina
>
> MIT PhD Student, Department of Economics
> MIT Energy Initiative Energy Fellow
> (925) 349 - 8999 (cell)
>
>
>
> On Mon, Feb 21, 2011 at 11:23 AM, Ista Zahn <izahn at psych.rochester.edu> wrote:
>> Hi Tatyana,
>> I think you are looking for ?sink
>>
>> Best,
>> Ista
>>
>> On Mon, Feb 21, 2011 at 2:11 PM, Tatyana Deryugina <tatyanad at mit.edu> wrote:
>>> Hi everyone,
>>>
>>> Is there a way to make R save the workspace output (just the results,
>>> not the objects themselves) as you go? I'm running analysis that takes
>>> a long time to run and I want to be able to interrupt it without
>>> losing all the output to date. Is there an alternative to putting
>>> "save.image()" commands after every couple lines of code?
>>>
>>> Best,
>>> Tatyana
>>>
>>> ______________________________________________
>>> R-help at 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.
>>>
>>
>>
>>
>> --
>> Ista Zahn
>> Graduate student
>> University of Rochester
>> Department of Clinical and Social Psychology
>> http://yourpsyche.org
>>
>



-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org



More information about the R-help mailing list