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"
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With