This section can be safely ignored by almost all users.
On some text editors, you can modify syntax highlighting so that the "start of comment block" marker is set to the string "doc=flatdoc(".
It's possible to use flatdoc
to read in more than one free-format text attribute. The EOF
argument can be used to distinguish one block of free text from the next. These attributes can be accessed from your function via attr( sys.function(), "<<attr.name>>")
, and this trick is occasionally useful to avoid having to include multi-line text blocks in your function code; it's syntactically clearer, and avoids having to escape quotes, etc. mvbutils:::docskel
shows one example.
fixr
uses write.sourceable.function
to create text files that use the flatdoc
convention. Its counterpart FF
reads these files back in after they're edited. The reading-in is not done with source
but rather with source.mvb
, which understands flatdoc
. The call to doc=flatdoc
causes the rest of the file to be read in as plain text, and assigned to the doc
attribute of the function. Documentation can optionally be terminated before the end of the file with the following line:
<<end of doc>>
or whatever string is given as the argument to flatdoc
; this line will cause source.mvb
to revert to normal statement processing mode for the rest of the file. Note that vanilla source
will not respect flatdoc
; you do need to use source.mvb
.
flatdoc
should never be called from the command line; it should only appear in text files designed for source.mvb
.
The rest of this section is probably obsolete, though things should still work.
If you are writing informal documentation for a group of functions together, you only need to flatdoc
one of them, say myfun1
. Informal help will work if you modify the others to e.g.
myfun2 <- structure( function(...) { whatever}, doc=list("myfun1"))
If you are writing with doc2Rd
in mind and a number of such functions are to be grouped together, e.g. a group of "internal" functions in preparation for formal package release, you may find make.usage.section
and make.arguments.section
helpful.