Learn R Programming

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

Rdpack (version 0.4-14)

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-14

License

GPL (>= 2)

Maintainer

Georgi Boshnakov

Last Published

April 16th, 2014

Functions in Rdpack (0.4-14)

inspect_slots

Inspect the slots of an S4 class
Rdo_sections

Locate the sections in Rd objects
get_usage_text

Get the text of the usage section of Rd documentation
char2Rdpiece

Convert a character vector to Rd piece
Rdo_piecetag

Give information about Rd elements
Rdo_show

Convert an Rd object to text and show it
S4formals

Give the formal arguments of an S4 method
.bsdup

Escape backslashes and percent in Rd code
Rdo_append_argument

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

Get the names of arguments in usage sections of Rd objects
Rdo_flatinsert

Insert content in an Rd fragment
rdo_text_restore

~~ Dummy title ~~
inspect_usage

Inspect the usage section in an Rd object
Rdo_set_section

Replace a section in an Rd file
promptUsage

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

Remove srcref attributes from Rd objects
Rd_combo

Manipulate a number of Rd files
promptPackageSexpr

Generates a shell of documentation for an installed package
Rdo_collect_metadata

Collect aliases or other metadata from an Rd object
Rdo_modify_simple

Simple modification of Rd objects
Rdo_which

Find elements of Rd objects for which a condition is true
update_aliases_tmp

Update aliases for methods in Rd objects
parse_Rdpiece

Parse a piece of Rd source text
Rdo2Rdf

Convert an Rd object to Rd file format
inspect_Rd

Inspect and update an Rd object or file
append_to_Rd_list

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

Apply a function over an Rd object
predefined

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

Get all references from a Bibtex file
compare_usage1

Compare usage entries for a function
Rdo_tags

Give the Rd tags at the top level of an Rd object
inspect_args

Inspect the argument section of an Rd 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, reprompt, 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 brief 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]
reprompt

Update the documentation of a topic
.asym_compare

Tensor comparison and asymmetric comparison between two vectors
parse_pairlist

Parse formal arguments of functions
parse_Rdtext

Parse Rd source text as the contents of a section
Rdo_locate

Find positions of elements in an Rd object
rebib

Work with bibtex references in Rd documentation
Rdo_empty_sections

Find or remove empty sections in Rd objects
inspect_signatures

Inspect signatures of S4 methods
Rdo_tag

Set the Rd_tag of an object
parse_text

Parse expressions residing in character vectors
c_Rd

Concatenate Rd objects or pieces
Rdreplace_section

Replace the contents of a section in one or more Rd files
Rdo_get_item_labels

~~ Dummy title ~~
format_funusage

Format the usage text of functions
Rdo_insert_element

Insert a new element in an Rd object
Rdo_locate_leaves

Find leaves of an Rd object using a predicate
Rdo_is_newline

Check if an Rd fragment represents a newline character
deparse_usage

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

Combine Rd fragments
parse_Rdname

Parse the name section of an Rd object
parse_usage_text

Parse usage text
bibentry_key

Give the key associated with a bibentry element
Rdo_modify

Replace or modify parts of Rd objects
Rdo_macro

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

Find the position of an "Rd_tag"
Rdo_insert

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

Reparse an Rd object
get_sig_text

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

Internal functions used by reprompt