[R-pkg-devel] toy example for testing purpose

Uwe Ligges ||gge@ @end|ng |rom @t@t|@t|k@tu-dortmund@de
Wed Aug 17 16:47:03 CEST 2022



On 16.08.2022 20:28, Zhang, Xueqiong wrote:
> Hi all,
> 
>    I got this comment from our CRAN package reviewer ( blue content 
> below) , but I am not sure how to fix it ?
> 
>   If I put @example in source .R with \donttest then I lose the example 
> run; if without \donttest then the CPU time will exceed 5 sec.  I 
> already do have examples in vignettes.  Do I need add test calls in 
> other place/script?

Well, ideally you have short examples so that users see quickly how your 
function can be called. Ideally examples take less than 5 sec., becuase 
users are typically not very patient when runningn exmaples from help pages.

If your examples are lengthy we ask you to put them in \donttest{} but 
try to provide short ones in addition to the lengthy ones (rather 
provide some tiny toy data, use few iterations etc)

If all ends up in \donttest{}, no vignette runtime code and no tests, 
your packages won't have any code executed at runtime which is of course 
a vey bad idea. SAo we ask to provide tests in case you do not provide 
examples that get auto-executed during the checks.
In vignettes we typically see a workflow tested, but not all 
functionality of the package, and frequently only subseta of provided 
functions get executed in vignettes...

Best,
Uwe Ligges







> Thanks,
> 
> Joan
> 
> /
> />>>>>>>>>>>>>>>>>>>>>>>>>
> 
> 
> 
> Putting the lengthy examples in \donttest is correct. However, it would
> be great if you either could write shorter toy examples or if not
> possible at least write some test so that we can check the functionality
> of your functions.
>



More information about the R-package-devel mailing list