r - 如何解决 devtools 不需要的副作用

标签 r devtools

我在使用 devtools 函数时遇到了非常奇怪的副作用。这是一个简单的例子。 基本上,我启动一个干净的 R session ,创建一个空包,然后使用 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
> 

这是 session 信息:

> 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 子集功能不再工作。如果您能给我一些解决问题的建议,我将不胜感激。

最佳答案

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

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

关于r - 如何解决 devtools 不需要的副作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24036019/

相关文章:

php - Laravel 代码仅在开发工具打开时才工作

google-chrome - Google Chrome 的 DevTools 的网络选项卡中的齿轮图标是什么意思?

r - 记录 ggplot2 统计扩展 - devtools::document() 未创建 packagename-ggproto.Rd

r - 错误 : no library trees found in 'lib.loc' when deploying Shiny App

r - 用长度相等或更大的字符串有效地替换固定位置的子字符串

r - 未知累积函数的反函数

linux - 无法为安装在 linux redhat 服务器上的 R studio 安装 Devtools 包

javascript - [无论] :[number] construct mean in the developer console? 是什么意思

r - Ubuntu 22.04 中 R impish repo 的问题 - impish-cran40

python - 在 Python 中使用周期性正态分布 (von Mises) 提取时间特征