[inlinedocs] tabs before comments and symbols, S3 methods

Thomas Wutzler twutz at bgc-jena.mpg.de
Wed Apr 21 12:37:36 CEST 2010


Hello Toby,

> Yes, I have given some thought to adding examples inline in the code,
> but I don't like it, because when the example code is commented, it is
> harder to edit and test. 
I agree.
However, for simple examples it would be very nice, to have it directly
documented in the function.
It would be quickly implemented.

> Instead, I prefer to add a corresponding file in the tests
> subdirectory, and take the examples from this.
I also thought about this.
Why not allow both ways?

One could think about naming conventions: e.g. for function myFunction
include the body of .example.myFunction into the examples section of
myFunction.
With using NAMESPACE to exclude .example*, one could code
.example.myFunction directly below myFunction.
On R CMD check the examples are tested anyway.

I also thought about the possibility of an include directive
##examplesUtest<< testFunctionName
to include teh body of a testFunction from RUnit (or svUnit).
testFunctionName is then a method in the corresponding TestUnit
(unitTests/runitmyFunction.R)

Yours,
Thomas


More information about the Inlinedocs-support mailing list