Long time examples on R package functions for CRAN
Asked Answered
U

0

10

I'm at the final steps of publishing my package. As I did a initial submit to CRAN, they commented about the examples check:

Also,

* checking examples ... [169s/169s] OK

Examples with CPU or elapsed time > 5s
                   user system elapsed
function1        66.240  0.004  66.248
function2        54.404  0.020  54.430
function3        47.060  0.192  47.252

and the CRAN Policy asks for only a few seconds: can you pls reduce the above run times accordingly?

Each listed function above consists on a estimator using a iterative proccess and they use pretty intensive computations.

Here is the deal: I can limit, just for the illustrative example, the number of iterations with a parameter of these functions, but these would provide estimates that did not converge. Also, the illustrative dataset used for the estimation proccess is pretty small, so I can't get too much better without limiting the iterations number.

In other words, I have long time examples on my package... what is the best strategy/practice to publish the package in this situation? Should I limit the iterations, remove the examples or there is another way?

This is my first attempt to publish a package. Sorry for this kind of doubt.

Unifilar answered 11/1, 2016 at 15:35 Comment(6)
I usually wrap my longer examples in \dontrun{...}. The examples will still be there for the user to reference, but they won't get run by check.Distributive
Does this bypass the CRAN check for example times? I thought this was only for gaining time on development, but with the CRAN checks still ocurring when submiting.Unifilar
Another doubt: \dontrun{...} is for 'wrong examples'. Can I use it for a good example that is just pretty intensive?Unifilar
From Writing R Extensions, "You can use \dontrun{} for text that should only be shown, but not run,...Thus, example code not included in \dontrun must be executable!...it need not be valid R code." So check won't be running anything in \dontrun{}, but it will run anything in \dontshow{}Distributive
Where does "\dontrun{...} is for 'wrong examples'." come from? Please provide a reference.Umbilicate
I've just rechecked this part of the hadley's tutorial: "For the purpose of illustration, it’s often useful to include code that causes an error. \dontrun{} allows you to include code in the example that is not run.". You are right, I suppose I can use it for longtime runs, sorry for the mistake.Unifilar

© 2022 - 2024 — McMap. All rights reserved.