如何将前一个表达式的结果赋给变量?

发布于 2024-09-18 07:34:57 字数 224 浏览 1 评论 0原文

假设我正在使用 R 的交互式控制台,并且我刚刚做了这样的事情:

long_running_command()

长时间运行的命令返回一个值,并且我刚刚意识到我想将该值分配给变量而不是丢弃它。那么如何在不再次运行命令的情况下获得该值呢?有这样的命令吗?

result = get_last_return_value()

Suppose I'm using R's interactive console, and I've just done something like this:

long_running_command()

That long-running command returns a value, and I've just realized that I wanted to assign that value to a variable instead of discard it. So how can I get that value without running the command again? Is there a command like this?

result = get_last_return_value()

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野心澎湃 2024-09-25 07:34:57

.Last.value 是一个答案。

已回答一次,但您有一个更好的标题。

.Last.value is an answer.

It was answered once but you have a better title.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文