Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

r

cmd

devtools

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"
like image 373
ayalaall Avatar asked Sep 27 '22 23:09

ayalaall


1 Answers

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.

like image 174
solarchemist Avatar answered Oct 13 '22 12:10

solarchemist