getAnywhere(timestamp) 2 diff-6ren">
gpt4 book ai didi

r - getAnywhere ("timestamp") 从 Rstudio 中找到两个函数

转载 作者:行者123 更新时间:2023-12-04 11:39:32 25 4
gpt4 key购买 nike

我正在尝试调用 timestamp Rstudio 中的函数,但似乎调用的版本不是我想要的版本。 getAnywhere表明有2个定义:

> getAnywhere(timestamp)
2 differing objects matching ‘timestamp’ were found
in the following places
package:utils
namespace:utils
Use [] to view one of them

> timestamp
function(...) .rs.callAs(name,
hook,
original,
...)
<environment: 0x0000000005f42030>

> timestamp()
##------ Thu Mar 06 15:08:51 2014 ------##

> utils::timestamp
function (stamp = date(), prefix = "##------ ", suffix = " ------##",
quiet = FALSE)
{
stamp <- paste0(prefix, stamp, suffix)
.External2(C_addhistory, stamp)
if (!quiet)
cat(stamp, sep = "\n")
invisible(stamp)
}
<bytecode: 0x0000000005f447a8>
<environment: namespace:utils>

调用 utils::timestamp()使 RStudio 崩溃。如果我只是调用 timestamp ,但它似乎忽略了参数。
> timestamp(prefix = "##-ddg-- ", quiet=TRUE)

这不会更改与 timestamp 关联的前缀。 , 并将输出返回到控制台,当 quiet 为真时它不应该这样做。

这是运行 R 3.0.1、RStudio 0.97.551、Windows 7 Enterprise service pack 1。

在我的 Mac 上, getAnywhere给出稍微不同的结果和 timestamp功能正常工作。
> getAnywhere(timestamp)
A single object matching ‘timestamp’ was found
It was found in the following places
package:utils
namespace:utils
with value

function (stamp = date(), prefix = "##------ ", suffix = " ------##",
quiet = FALSE)
{
stamp <- paste0(prefix, stamp, suffix)
.External2(C_addhistory, stamp)
if (!quiet)
cat(stamp, sep = "\n")
invisible(stamp)
}
<bytecode: 0x7fd90b10bdb8>
<environment: namespace:utils>

Windows 上的第二个定义来自哪里?如何让 R 调用正确的版本?

谢谢你的帮助。

芭芭拉

最佳答案

在评论中,乔纳森回答了 Windows 上的第二个定义来自哪里? 崩溃 问题的一部分

On Windows RStudio replaces timestamp with its own method because the default method has dependencies that aren't met in the RStudio environment (which is what causes the crash you see when you invoke it directly). Its method is a replacement for timestamp, however, not a wrapper, and the replacement doesn't support all the parameters of the original. I'd encourage you to report the problem on the RStudio support forum.



您已在 RStudio Support page 上确认.在较早的 RStudio support thread 上也有报道。 .

不幸的是,RStudio 的错误数据库看起来是内部的,因此您需要按照 commit history 进行监控。或 latest version 的发行说明或 preview release .

关于r - getAnywhere ("timestamp") 从 Rstudio 中找到两个函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22566317/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com