[R-pkg-devel] How to reduce examples in a package that takes more than 5 seconds to run?

Ismail Otoakhia oto@kh|@| @end|ng |rom gm@||@com
Fri Dec 16 15:51:46 CET 2022


Thanks, everyone. From the ideas shared, I adopted the following on the .rd
files:
\examples{
\dontrun{
...
...
...
}
}
The "..." are the examples which take more than 5 seconds to run. I hope
this resolved the CRAN team's request.


E. I Otoakhia


On Thu, Dec 15, 2022 at 4:26 PM Spencer Graves <
spencer.graves using effectivedefense.org> wrote:

>
>
> On 12/15/22 9:02 AM, Ben Bolker wrote:
> >
> >
> > On 2022-12-15 9:57 a.m., Brian G. Peterson wrote:
> >> On 12/15/22 08:34, Ismail Otoakhia wrote:
> >>> The R package 'ardl.nardl' has some examples that take more than 5
> >>> seconds
> >>> to run. I was advised by the CRAN team to reduce the run time to less
> >>> than
> >>> 5 seconds.
> >>>
> >>> How can this be achieved?
> >>
> >> - you can lower the amount of data in the example
> >>
> >> - you can use a faster method than your default method
> >>
> >> - you can wrap the example in a dontrun tag so it will not run during
> >> checking
> >>
> >
> >    If your example involves something like a fitted model object that
> > takes a long time to compute, you can pre-compute the model fit and
> > store the object in an inst/testdata directory, then use something like
> >
> > fitted_model <- readRDS(system.file("testdata", "my_example.rds",
> > package = "mypackage"))
> >
> > to retrieve it
>
>
>           The "sos" package includes a function "CRAN", which is used for
> that
> purpose.  The examples section in "findfn.Rd" includes the following:
>
>
> # Skip these tests on CRAN,
> # because they take more than 5 seconds
> if(!CRAN()){
> ...
> }
>
>
>           I know that some on this list do not like this construct, but it
> has
> helped me manage this problem for several years.  NOTE:  This CRAN
> function is NOT maintained by anyone on CRAN, so it is NOT guaranteed to
> work.  However, the "sos" package is currently on CRAN, and I have not
> seen an email asking me to avoid it ;-)
>
>
> https://github.com/sbgraves237/sos/blob/master/man/findFn.Rd
>
>
>           Hope this helps.
>           Spencer Graves
> >
> >> ______________________________________________
> >> R-package-devel using r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-package-devel
> >
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list