Reputation: 697
How should I write documentation for R reference classes? I looked in "Writing R extentions" on CRAN, but I found only instructions for S3 and S4 objects.
Can anyone provide an example of documentation for a R ref class and its related methods?
Upvotes: 1
Views: 168
Reputation: 94192
The documentation for setRefClass
explains all this, and gives examples. You add help text for methods as strings within the method definition:
Documentation for the methods can be obtained by the
$help
method for the generator object. Methods for classes are not documented in the Rd format used for R functions. Instead, the$help
method prints the calling sequence of the method, followed by self-documentation from the method definition, in the style of Python. If the first element of the body of the method is a literal character string (possibly multi-line), that string is interpreted as documentation.
Upvotes: 1