Search code examples
rdocumentationrd

Automatically documenting multiple S3 methods in one file


Since initially running package.skeleton to create a package, I have added several S3 classes. Each of these classes has 5-10 methods. I've discovered the wonderful prompt command to create .Rd files from a function loaded into memory, but is it possible to have R automagically create a single help file that has all multiple functions documented? I'm thinking of something like an enhanced version of prompt where you would pass it a list of functions, and it would create a single .Rd file with only the additional information added to the help file.

For instance, if I have a generic called duration, and classes for which there are methods duration.bond(market,...), duration.account(market,time,...), duration.portfolio(market,...), I would like prompt to create a helpfile with a \usage section containing each \method{} and an \arguments{} section containing market,\dots, and time.

Any hope here? Copying and pasting is getting very tiring!


Solution

  • For completeness, adding in what I chose to do here, which is to pick the method that has the most arguments and use prompt on that, then add in the other methods manually to the same help file.

    The other alternative would have been to use Rd2roxygen to convert everything that was already in .Rd back to Roxygen and then use Roxygen for the whole project. This will likely be what I do in the next release.