【问题标题】:How to troubleshoot devtools unwanted side effects如何对 devtools 不必要的副作用进行故障排除
【发布时间】:2014-06-04 11:19:07
【问题描述】:

我在使用 devtools 函数时遇到了非常奇怪的副作用。这是一个简单的例子。 基本上,我启动一个干净的 R 会话,创建一个空包,然后使用 load_all 加载新包。一旦我这样做了,帮助功能就不再起作用了。这是屏幕截图:

R version 3.1.0 (2014-04-10) -- "Spring Dance"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> setwd("c:/Scratch")
> require(devtools)
Loading required package: devtools

Attaching package: ‘devtools’

The following objects are masked from ‘package:utils’:

    ?, help

The following object is masked from ‘package:base’:

    system.file

> help("data.frame")
starting httpd help server ... done
> create("mypackage",rstudio=F)
Creating package mypackage in .
No DESCRIPTION found. Creating with values:

Package: mypackage
Title: What the package does (short line)
Version: 0.1
Authors@R: "First Last <first.last@example.com> [aut, cre]"
Description: What the package does (paragraph)
Depends: R (>= 3.1.0)
License: What license is it under?
LazyData: true
> help("data.frame")
> load_all("mypackage")
Loading mypackage
> help("data.frame")
Error in names(t1) <- rep(names(L), lapply(L, length)) : 
  attempt to set an attribute on NULL
> 

这是会话信息:

> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: i386-w64-mingw32/i386 (32-bit)


attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] mypackage_0.1 devtools_1.5 

loaded via a namespace (and not attached):
[1] digest_0.6.4   evaluate_0.5.5 httr_0.3       memoise_0.2.1  parallel_3.1.0 RCurl_1.95-4.1 stringr_0.6.2  tools_3.1.0    whisker_0.3-2 
> 

帮助命令不起作用只是一个例子,我注意到还有一些其他奇怪的东西。像 data.table 子集功能不再起作用。如果您能给我一些解决问题的方法,我将不胜感激。

【问题讨论】:

  • 你有没有机会在./data 或默认load_all 看起来的类似目录中找到?
  • 感谢您的帮助。我看了看,但包是在一个空目录中从头开始创建的。我用--no-init-file --no-restore 启动R。并且 ls() 返回空。
  • 接下来要尝试的是utils::help('data.frame'),以验证devtools::help 是否存在问题。
  • utils::help('data.frame') 有效,但 devtools::help('data.frame') 无效,这是回溯 6: invert(lapply(rds, aliases)) 5: build_topic_index(pkg) 4: topic_index(pkg) 3: find_pkg_topic(path, topic) 2: find_topic(topic_str) 1: help("aaa")

标签: r devtools


【解决方案1】:

这是 devtools 1.5 中的一个错误,当项目没有帮助文件时会发生这种错误。我刚刚推送了一个修复程序。

在非 Windows 平台上,您可以使用 devtools::install_github('hadley/devtools') 更新到最新版本。在 Windows 上,请参阅 ?build_github_devtools 了解有关如何更新的说明。

【讨论】:

    猜你喜欢
    • 2011-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多