parse_Rd {tools}R Documentation

Parse an Rd file

Description

This function reads an R documentation (Rd) file and parses it, for processing by other functions.

It is experimental.

Usage

parse_Rd(file, srcfile = NULL, encoding = "unknown", verbose = FALSE)

Arguments

file A filename or text-mode connection. At present filenames work best.
srcfile NULL, or a "srcfile" object. See the ‘Details’ section.
encoding Encoding to be assumed for input strings.
verbose Logical indicating whether detailed parsing information should be printed.

Details

This experimental function parses Rd files according to the specification given in http://developer.r-project.org/parseRd.pdf. At the current writing, this is not identical to the rules used by other tools: it is somewhat stricter.

Value

An object of class "Rd". The internal format of this object is subject to change.
At present files which are marked as Latin-1 or UTF-8 or where encoding has one of those values result in text marked in the encoding. In a non-UTF-8 MBCS locale the result will be marked as UTF-8. In all other cases files are assumed to be in the native encoding.

Warning

These functions are still experimental. Names, interfaces and values might change in future versions.

Author(s)

Duncan Murdoch

References

http://developer.r-project.org/parseRd.pdf

See Also

Rd2HTML.

Rd_parse, the function used for parsing Rd files by R CMD check.

Examples

baseRd <- Rd_db("base")
con <- textConnection(baseRd[[1]], "rt")
parse_Rd(con)
close(con)

[Package tools version 2.9.1 Index]