Re: [Rd] hook for configuring checking of \example{} sections of the documentation during R CMD check

From: Duncan Murdoch <>
Date: Sun, 22 Jan 2012 18:24:51 -0500

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 mailing list Received on Sun 22 Jan 2012 - 23:28:05 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 23 Jan 2012 - 16:30:11 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive