Learn R Programming

mvbutils (version 2.2.0)

help2flatdoc: Convert help files to flatdoc format

Description

Converts a vanilla R help file (as used by the internal pager) to plain-text format. The output conventions are those in doc2Rd, so the output can be turned into Rd-format by running it through doc2Rd. This function is useful if you have existing Rd-format documentation and want to try out the flatdoc system of integrated code and documentation.

Usage

help2flatdoc( fun.name, pkgpath)

Arguments

fun.name
function name (a character string)
pkgpath
path of top-level directory of the package, i.e. containing the DESCRIPTION file.

Details

help2flatdoc looks first for a file with the name fun.name in the "help" subdirectory; failing that, it tries to unpack the file from the "Rhelp.zip" archive. It doesn't work on Rd-format files, but instead on the "built" pager-style help files produced by RCMD INSTALL etc. If you write documentation using flatdoc, prepare the package with pre.install, build it with RCMD BUILD or INSTALL, and run help2flatdoc on the result, you should largely recover your original flat-format documentation. Aliasses are deduced from function calls in the USAGE section. (Link-triggering phrases aren't explicitly created-- could look thru lists of linkable things I guess.)

See Also

doc2Rd

Examples

Run this code
all.libs <- library()$results
mvbutils.loc <- all.libs[ all.libs[,"Package"]=="mvbutils", "LibPath"][1]
cd.doc <- help2flatdoc( "cd", file.path( mvbutils.loc, "mvbutils")) # gives me back almost the original
print( cd.doc)
cd.Rd <- doc2Rd( cd.doc)
# now could cat cd.Rd to a file and invoke RCMD Rdconv/Rd2dvi to get back the cd doco.

Run the code above in your browser using DataLab