Skip to content

[R-pkg-devel] How to include examples that run > 5 secs and contain personal info

4 messages · Jorge Cimentada, Uwe Ligges, Maxime Turgeon +1 more

#
Hi,

I'm in the process of submitting a package to CRAN and I've run into an
issue with the examples of some functions. The purpose of nearly all
functions of the package is to download data from a website. There is one
main problem I've received from CRAN.

1) If it's feasible, include examples which are executed in < 5 secs.

Downloading data usually take between 5-10 seconds in the best case. I've
included most examples as \dontrun{} specifically because of this. There is
no way of creating smaller toy examples that run in less time.

Every time the function is run the user must specify his/her email, which
is private information Because the examples are not being executed, I've
included fake emails such as your at email.com to show the user how it works.
The CRAN team suggested using something like:

-----

\examples{
       examples for users:
       executable in < 5 sec
       for checks
       \dontshow{
              examples for checks:
              executable in < 5 sec together with the examples above
              not shown to users
       }
       donttest{
              further examples for users (not used for checks)
       }
}

-----

To the best of my knowledge, there is not way to get examples always
running < 5 secs, so it's not feasible to include them in \dontshow{}.
Also, I'm not sure if users can have access to \dontshow{} in any way by
going to the specific docs of the function (either on Github or somewhere
on the CRAN repo). I wouldn't want to reveal personal emails in any way,
even if it's for the tests.

Any idea how to handle this situation?

Note: I do included extensive tests which are successfully tested through
Travis CI and this wasn't an issue in the CRAN submission.

-----------------------------------


Jorge Cimentada
*https://cimentadaj.github.io/ <https://cimentadaj.github.io/>*
#
Then simply explain this situation to the CRAN team and "they" will 
probably let the package pass.

Best,
Uwe Ligges
On 06.11.2017 14:25, Jorge Cimentada wrote:
#
Hi Jorge,


All the Rd files are available to users if they download the source code. They are also available through the CRAN mirror on Github (github.com/cran). In other words, you shouldn't put personal information in the help files, even if you use the 'dontshow' macro.


Max
1 day later
#
There are also lots of ways to "mock" examples / tests. You might give
examples that are "not run" in your code, and then if you want to "test"
the functionality, use "testthat" with mocked tests, that don't involve
hitting the website, except for a single case to make sure that particular
function works.

These might be helpful:
https://www.mango-solutions.com/blog/testing-without-the-internet-using-mock-functions

Also, look at the use of this functionality in devtools:
https://github.com/hadley/devtools/search?utf8=%E2%9C%93&q=with_mock&type=

Hope that helps!

-Robert

Robert M Flight, PhD
Bioinformatics Research Associate
Puller of Rabbits from Hats
Research Parasite
Resource Center for Stable Isotope Resolved Metabolomics
Manager, Systems Biology and Omics Integration Journal Club
Markey Cancer Center
CC434 Roach Building
University of Kentucky
Lexington, KY

Twitter: @rmflight
Web: rmflight.github.io
ORCID: http://orcid.org/0000-0001-8141-7788
EM rflight79 at gmail.com
PH 502-509-1827 <(502)%20509-1827>

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. - Ronald Fisher

On Mon, Nov 6, 2017 at 8:58 AM Maxime Turgeon <maxime.turgeon at mail.mcgill.ca>
wrote: