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

Bar*_*ara 5 r rstudio

我试图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>
Run Code Online (Sandbox Code Playgroud)

呼叫utils::timestamp()崩溃RStudio.如果我只是打电话timestamp,它似乎忽略了参数.

> timestamp(prefix = "##-ddg-- ", quiet=TRUE)
Run Code Online (Sandbox Code Playgroud)

这不会更改与之关联的前缀timestamp,并且会将输出返回到控制台,当quiet为true时,它不应该执行此操作.

这是运行R 3.0.1,RStudio 0.97.551,Windows 7企业服务包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>
Run Code Online (Sandbox Code Playgroud)

这第二个定义来自Windows?如何让R拨打正确的版本?

谢谢你的帮助.

芭芭拉

The*_*ell 2

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

在 Windows 上,RStudio 用自己的方法替换时间戳,因为默认方法具有 RStudio 环境中不满足的依赖项(这就是导致您直接调用它时看到的崩溃的原因)。它的方法是时间戳的替代,但不是包装器,并且替代不支持原始的所有参数。我鼓励您在 RStudio 支持论坛上报告该问题。

您已在RStudio 支持页面上确认了这一点。还报告了早期的RStudio 支持线程

不幸的是,RStudio 的错误数据库看起来是内部的,因此您需要通过遵循最新版本预览版本提交历史记录或发行说明来监视它。