Learn R Programming

⚠️There's a newer version (2.6.5) of this package.Take me there.

Rdpack (version 0.4-4)

Update and manipulate Rd documentation objects

Description

Functions for manipulation of Rd objects, including function reprompt for updating existing Rd documentation for functions, methods and classes, and function rebib for import of references from Bibtex files.

Copy Link

Version

Install

install.packages('Rdpack')

Monthly Downloads

414,722

Version

0.4-4

License

GPL (>= 2)

Maintainer

Georgi Boshnakov

Last Published

April 13th, 2013

Functions in Rdpack (0.4-4)

c_Rd

Concatenate Rd objects or pieces
parse_usage_text

Parse usage text
get_sig_text

Produce the textual form of the signatures of available methods for an S4 generic function
predefined

Tables of predefined sections and types of pieces of Rd objects
parse_Rdname

Parse the name section of an Rd object
Rdo2Rdf

Convert an Rd object to Rd file format
promptPackageSexpr

Generates a shell of documentation for an installed package
list_Rd

Combine Rd fragments
Rdo_modify

Replace or modify parts of Rd objects
Rdo_modify_simple

Simple modification of Rd objects
append_to_Rd_list

Add content to the element of an Rd object or fragment at a given position
update_aliases_tmp

Update aliases for methods in Rd objects
rebib

Work with bibtex references in Rd documentation
Rdo_sections

Locate the sections in Rd objects
Rdo_locate_leaves

Find leaves of an Rd object using a predicate
Rdo_remove_srcref

Remove srcref attributes from Rd objects
Rdo_insert_element

Insert a new element in an Rd object
Rdo_empty_sections

Find or remove empty sections in Rd objects
Rdo_set_section

Replace a section in an Rd file
inspect_Rd

Inspect and update an Rd object or file
Rdo_macro

Format Rd fragments as macros (todo: a baffling title!)
parse_Rdpiece

Parse a piece of Rd source text
.asym_compare

Tensor comparison and asymmetric comparison between two vectors
rdo_text_restore

~~ Dummy title ~~
.capture_promptAny

Internal functions used by reprompt
bibentry_key

Give the key associated with a bibentry element
Rdapply

Apply a function over an Rd object
Rdo_get_insert_pos

Find the position of an "Rd_tag"
inspect_args

Inspect the argument section of an Rd object
Rdo_locate

Find positions of elements in an Rd object
promptUsage

Usage text for a function, S3 method or S4 method
get_bibentries

Get all references from a Bibtex file
Rdo_locate_predefined_section

Locate the position of a predefined section
Rdo_is_newline

Check if an Rd fragment represents a newline character
Rdo_tag

Set the Rd_tag of an object
Rdpack-package

[stage=build,results=hide]{require(Rdpack)} [stage=build,results=hide]{pd <- packageDescription("Rdpack")} [stage=build,results=hide]{lb <- library(help="Rdpack", character.only=TRUE)} [stage=build]{pd$Title} [stage=build]{pd$Description}
ll{ Package: [stage=build]{pd$Package} Type: [stage=build]{pd$Type} Version: [stage=build]{pd$Version} Date: [stage=build]{pd$Date} License: [stage=build]{pd$License} LazyLoad: [stage=build]{pd$LazyLoad} Built: [stage=build]{pd$Built} Index: [stage=build,results=rd]{paste("\\preformatted{", paste(if(!is.null(lb$info[[2]])) lb$info[[2]] else "No entries",collapse="\n"), "}", sep="")} Package Rdpack may be help authors of Rpackages to keep their documentation up to date during development. Although base R and package methods have functions for creation of skeleton documentation, if a function gets a new argument or a generic gets a new method, then updating existing documentation is somewhat inconvenient. This package provides functions that update parts of the Rd documentation that can be dealt with automatically and leave manual changes untouched. For example, usage sections for functions are updated and if there are undescribed arguments, additional items are put in the `arguments' section. Another set of functions is for management of bibliographic references. The main functions provided by this package are reprompt, promptPackageSexpr, and rebib. reprompt produces a skeleton documentation for the requested object, similarly to functions like prompt, promptMethods, and promptClass. Unlike those functions, reprompt updates existing documentation (installed or in an Rd object or file) and produces a skeleton from scratch as a last resort only. If the documentation object describes more than one function, all descriptions are updated. Basically, reprompt updates things that are generated automatically, leaving manual editing untouched. The typical use of reprompt is with one argument, as in reprompt(infile = "./Rdpack/man/reprompt.Rd") reprompt(reprompt) reprompt("reprompt") reprompt updates the documentation of all objects described in the Rd object or file, and writes the updated Rd file in the current working directory, see reprompt for details. promptPackageSexpr creates a skeleton for a package overview in file name-package.Rd. Then the file can be edited as needed. This function needs to be called only once for a package since automatic generation of information in name-package.Rd is achieved with Sexpr's at build time, not with verbatim strings as promptPackage does. For example, the source of this help page is file `Rdpack-package.Rd'. It was initially produced using promptPackageSexpr("Rdpack") The factual information at the beginning of this help topic (the index above, the version and other stuff that can be determined automatically) is kept automatically up to date. rebib updates the bibliographic references in an Rd file. Rdpack uses a simple scheme for inclusion of bibliographic references. The key for each reference is in a TeX comment line, as in: \references{ ... % bibentry: key1 % bibentry: key2 ... } rebib puts each reference after the line containing its key. It does nothing if the reference has been put by a previous call of rebib. If the Bibtex entry for some references changes, it may be necessary to update them in the Rd file, as well. Call rebib with force = TRUE to get this effect. There is also a facility to include all references from the Bibtex file, see the documentation of rebib for details. The Bibtex source for the references is by default a file "REFERENCES.bib" located in the root of the package installation folder. Note that there are other, more sophisticated, approaches to keeping documentation and code in synchron, for example package roxygen (todo: give references here). It can hardly get simpler than using a single function with one argument (the doc file or the object to be updated) to update all sorts of Rd documentation files. Some may find that this is all they need and not bother with the rest of this documentation. Other functions that may be useful are Rdo2Rdf, Rdapply and Rd_combo. Here is also brrief information about some more technical functions that may be helpful in certain circumstances. c_Rd concatenates Rd pieces, character strings and lists to create a larger Rd piece or a complete Rd object. list_Rd is similar to c_Rd but provides additional features for convenient assembling of Rd objects. parse_Rdpiece is technical function for parsing pieces of Rd source text but it has an argument to return formatted help text which may be useful when one wishes to show it to the user. Rdo_set_section can be used to set a section, such as "[object Object]". The remaining functions in the package are for programming with Rd objects (and probably many of them should not be exported). [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Rdo_collect_aliases

Collect aliases in an Rd object
get_usage_text

Get the text of the usage section of Rd documentation
S4formals

Give the formal arguments of an S4 method
Rdo_flatinsert

Insert content in an Rd fragment
reprompt

Update the documentation of a topic
Rdo_piecetag

Give information about Rd elements
.bsdup

Escape backslashes and percent in Rd code
compare_usage1

Compare usage entries for a function
inspect_slots

Inspect the slots of an S4 class
parse_Rdtext

Parse Rd source text as the contents of a section
parse_text

Parse expressions residing in character vectors
format_funusage

Format the usage text of functions
inspect_signatures

Inspect signatures of S4 methods
Rdo_show

Convert an Rd object to text and show it
Rdo_append_argument

Append an item for a new argument to an Rd object
char2Rdpiece

Convert a character vector to Rd piece
inspect_usage

Inspect the usage section in an Rd object
deparse_usage

Convert f_usage objects to text appropriate for usage sections in Rd files
Rd_combo

Manipulate a number of Rd files
Rdo_insert

Insert a new element in an Rd object possibly surrounding it with new lines
Rdo_reparse

Reparse an Rd object
parse_pairlist

Parse formal arguments of functions