1
votes

I'm currently revising an R package to accommodate API access changes: the API now requires an individual's email address and access key to work.

Therefore, the package also requires an email address and access key now (first two arguments). For this reason, the code examples provided for the function acled.api() don't make it through the usual checks anymore. Is someone aware of a way to make the examples run for the checks without hard-coding my own access key (which is of course not an option)?

My current solution is to "comment out" the function examples so that the checks won't return errors, but I can imagine that this is bad practice (or may violate some CRAN policy). Example code:

    #' # my.data.frame1 <- acled.api(email.address = "your.email.address",
    #' #   access.key = "your.access.key",
    #' #   region = c(1,7),
    #' #   start.date = "2018-11-01",
    #' #   end.date = "2018-11-31")
    #' # head(my.data.frame1)

I have been searching online for information on this issue to no avail - if someone is aware of any info or CRAN policies that I missed please let me know.

Cheers and best wishes, Chris

1

1 Answers

0
votes

This is one of those times when the answer comes around the corner right after asking the question. For anybody else who has this question and wasn't able to find the answer:

CRAN actually provides information on examples in section 2.1.1 Documenting functions. From that it transpires that it is okay if no examples are "run" by the usual checks. However instead of commenting out the examples, these ought to be enclosed by \dontrun{}.

Hopes this helps someone who is also searching for this info.

Cheers, Chris