Rdpack (version 0.4-20)

Rdo_append_argument: Append an item for a new argument to an Rd object

Description

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

Usage

Rdo_append_argument(rdo, argname, description = NA, indent = " ", create = FALSE)

Arguments

rdo
an Rd object
argname
name of the argument, a character vector.
description
description of the argument, a character vector.
indent
a string, typically whitespace.
create
not used (todo: remove?)

Value

an Rd object

Details

Appends one or more items to the section describing arguments of functions in an Rd object. The section is created if not present.

If description is missing or NA, a "todo" text is inserted.

The inserted text is indented using the string indent.

The lengths of argname and description should normally be equal but if description is of length one, it is repeated to achieve this when needed.

Examples

Run this code
# the following creates Rd object rdo
dummyfun <- function(x) x
fn <- tempfile("dummyfun", fileext=".Rd")
reprompt(dummyfun, filename=fn)
rdo <- parse_Rd(fn)

dottext <- "further arguments to be passed on."

# rdo2 <- Rdo_append_argument(rdo, "\dots", dottext, create = TRUE)
rdo2 <- Rdo_append_argument(rdo, "\dots", dottext, create = TRUE)
rdo2 <- Rdo_append_argument(rdo2, "z", "a numeric vector")
Rdo_show(reprompt(rdo2))

# todo: Rdo_show(rdob) for some reason does not show the arguments.
#       investigate! Rdo_show uses Rd2txt. Is it possible that the
#       latter needs srcref's in the Rd object? They are only refreshed
#       Rd_parse is called.


unlink(fn)

Run the code above in your browser using DataCamp Workspace