Sylvain Loiseau
2012-Jan-22 22:20 UTC
[Rd] hook for configuring checking of \example{} sections of the documentation during R CMD check
Dear all, In a new package, I try to check the examples given in the \example section of the Rd files. However, the examples cannot be run if the package is not instructed, during startup time, in the place where some data are to be found ( with system.file("exampleData", "xyz", package="rcqp"). Is there any hook available, or a place where some code might be added, so that it is executed before all the examples collected in Rd files are executed? Best regards, Sylvain Loiseau ----- Sylvain Loiseau sylvain.loiseau at univ-paris13.fr Universit? Paris 13-Nord Laboratoire Lexiques, Dictionnaires, Informatique (UMR 7187 CNRS/Universit? Paris 13-Nord) 99 avenue Jean-Baptiste Cl?ment F-93410 Villetaneuse
Duncan Murdoch
2012-Jan-22 23:24 UTC
[Rd] hook for configuring checking of \example{} sections of the documentation during R CMD check
On 12-01-22 5:20 PM, Sylvain Loiseau wrote:> Dear all, > > In a new package, I try to check the examples given in the \example section of the Rd files. > > However, the examples cannot be run if the package is not instructed, during startup time, in the place where some data are to be found ( with system.file("exampleData", "xyz", package="rcqp"). > > Is there any hook available, or a place where some code might be added, so that it is executed before all the examples collected in Rd files are executed?There are no special hooks for example files. You could do this in a package load hook, though it might be more trouble than it's worth. In your load hook, save the result of that call in a local variable. Then reference that variable from your examples. However, it's probably easiest just to put the line exampleData <- system.file("exampleData", package="rcqp") at the start of each example that needs it. Duncan Murdoch