在R中运球:如何将所有i / o复制到文件中? [英] Dribble in R: how to duplicate all i/o into a file?

查看:423
本文介绍了在R中运球:如何将所有i / o复制到文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有像 Common Lisp功能DRIBBLE Unix命令T恤?



具体来说,我希望我输入的所有内容 所有R打印返回给我以附加到文件中( tee 仅捕获标准输出;我想每次:错误,警告,打印,猫,我的输入。)



<我找到了一个 10年之久的消息提供弱版本的主题(它不捕获cat / print的输出)。



标准函数接收器捕获(不是重复 em>)R的输出;并且它捕获我的输入。



有更好的方法吗?

解决方案

查看TeachingDemos包中的 txtStart 函数(和相关函数)。我认为除了捕获错误之外它会做你想做的一切(并且R guts中的 TaskCallback 系统需要更新才能实现)。



另一种选择是在另一个环境中运行R,例如ESS(在Emacs内部)(还有其他环境,但我对它们不熟悉)。然后在编辑器/缓冲区中捕获所有内容并将其保存到文件中。



请注意 sink 函数确实有 split 参数,其作用类似于 tee ,以显示屏幕上的输出以及将其复制到文件中,但它仍然只输出输出,而不是输入命令。


Is there something like the Common Lisp function DRIBBLE or Unix command tee in R?

Specifically, I want everything I type and everything R prints back to me to be appended to a file (tee only captures stdout; I want everyting: errors, warnings, print, cat, my input).

I found a 10 year old message on the subject which offers a weak version of that (it does not capture the output from cat/print).

The standard function sink only captures (not duplicates) the R's output; and it does not capture my input.

Is there a better way?

解决方案

Look at the txtStart function (and related functions) in the TeachingDemos package. I think that it does everything you want except capturing errors (and the TaskCallback system in the R guts needs to be updated for that to happen).

The other option is to run R inside of another environment such as ESS (inside of Emacs) (there are others, but I am less familiar with them). Then everything is captured in the editor/buffer and can be saved to a file.

Note that the sink function does have a split argument that works like tee to show the output on screen as well as duplicate it to the file, but it still only does the output, not the input commands.

这篇关于在R中运球:如何将所有i / o复制到文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆