base::assign(“.ptime”, proc.time(), pos = “CheckExEnv”) ERROR when using devtools::check

别说谁变了你拦得住时间么 提交于 2019-12-07 14:33:49

问题


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?

Any help will be greatly appreciated

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"

回答1:


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.

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{...}.

See ?examples for more details on this as well as other options.



来源:https://stackoverflow.com/questions/32117334/baseassign-ptime-proc-time-pos-checkexenv-error-when-using-devtool

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!