使用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子集函数不再工作。如果你能给我一些指导你如何解决问题,我将不胜感激。
答案 0 :(得分:3)
这是devtools 1.5中的一个错误,当项目没有帮助文件时会发生这个错误。我只是推了一个修复。
在非Windows平台上,您可以使用devtools::install_github('hadley/devtools')
更新到最新版本。在Windows上,有关如何更新的说明,请参阅?build_github_devtools
。