将最后的输出捕获为R对象 [英] Capture last output as an R object

查看:94
本文介绍了将最后的输出捕获为R对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
如何分配上一个表达式在R中的变量的结果?

Possible Duplicate:
How to assign the result of the previous expression to a variable in R?

我正在ESS中使用R,只是犯了一个愚蠢的错误,即在不将结果分配给变量的情况下运行长时间运行的函数.因此,它只是打印出结果,一长串的输出看起来像:

I'm working with R in ESS and just made the stupid mistake of running a long running function without assigning the result to a variable. So, it just printed out the result, a long string of output that looks like:

[[1]]
1 FALSE
[[2]]
1 TRUE
[[3]]
1 TRUE
[[4]]
1 TRUE 

是否有任何方法可以将此打印输出强制转换为R对象?是在R中,还是在使用emacs(M-x undo-my-stupid-mistake)?

Is there any way to coerce this printed output into an R object? Either within R, or using emacs (M-x undo-my-stupid-mistake)?

推荐答案

也许可行:

out <- .Last.value

这篇关于将最后的输出捕获为R对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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