使用devtools :: check时,base :: assign(“。ptime”,proc.time(),pos =“ CheckExEnv”)错误 [英] base::assign(".ptime", proc.time(), pos = "CheckExEnv") ERROR when using devtools::check
问题描述
我正在使用 devtools :: check
对我的软件包进行R CMD检查,并且遇到相同的 ERROR
(请参见下方)在此处中进行了讨论。
我尝试执行建议的操作:在#'@ example $之前添加了
。但是我仍然遇到相同的错误。#'@ export
标签c $ c>在我的 prep.R
代码中,并且我还在<$ c $中添加了 export(prep)
c>名称空间
I am doing the R CMD check for my package using devtools::check
and I encountered the same ERROR
(see bellow) discussed here.
I tried to do what was suggested there: I added a tag of #'@export
before the #'@example
in my prep.R
code, and I also added export(prep)
in NAMESPACE
. However I still get the same error.
有人知道我该怎么解决吗?
Does anyone knows how can I solve this?
任何帮助都会非常感谢
Ayala
* checking R/sysdata.rda ... OK
* checking examples ... ERROR
Running examples in 'prepdat-Ex.R' failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: prep
> ### Title: Aggregate Long Format Data According to Grouping Variables and
> ### Generate a Number of Measures for Each Cell in the Aggregated Data
> ### for Further Analysis
> ### Aliases: prep
>
> ### ** Examples
>
> data(stroopdata)
> x1 <- prep(
+ dataset = stroopdata
+ , file_name = NULL
+ , id = "subject"
推荐答案
我在搜寻此确切错误时发现了这个问题,我想我现在明白为什么会这样:Roxygen实际上在 @examples
部分,我的代码包含未声明的对象,并在运行检查时给出了此确切错误。
I found this question when googling this exact error. I think I understand now why it occurred: Roxygen actually executes the code in the @examples
section, and my code included undeclared objects and gave this exact error when running check.
快速解决方案:删除 @examples
部分中令人反感的代码行。或者,更体贴的解决方案是将示例代码包含在 \dontrun {... }
。
Quick solution: remove the offending lines of code from the @examples
section. Or, a more considerate solution is to enclose the example code within \dontrun{...}
.
有关此内容以及其他选项的详细信息,请参见?examples
See ?examples
for more details on this as well as other options.
这篇关于使用devtools :: check时,base :: assign(“。ptime”,proc.time(),pos =“ CheckExEnv”)错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!