loading...

When a function or object is renamed, the link to its original help page is lost in R. Using aka() (also known as) with correct alias= allows to keep track of the original help page and get it with .?obj. Moreover, one can also populate a short man page with description, seealso and example or add a short comment message that is displayed at the same time in the R console.

aka(
  obj,
  alias = NULL,
  comment = "",
  description = NULL,
  seealso = NULL,
  example = NULL,
  url = NULL
)

# S3 method for aka
print(
  x,
  hyperlink_type = getOption("hyperlink_type", default = .hyperlink_type()),
  ...
)

# S3 method for aka
str(object, ...)

Arguments

obj

An R object.

alias

The full qualified name of the alias object whose help page should be retained as pkg::name. If NULL (by default), use obj.

comment

A comment to place in obj (will also be printed when calling .?obj).

description

A description of the function for the sort man page.

seealso

A character string of functions in the form fun or pkg::fun.

example

A character string with code for a short example.

url

An http or https URL pointing to the help page for the function on the Internet.

x

An aka object

hyperlink_type

The type of hyperlink supported. The default value should be ok. Use "none" to suppress hyperlink, "href" for http(s):// link that opens a web page, or "help" in RStudio to open the corresponding help page in the Help tab.

...

Further arguments (not used yet)

object

An aka object

Value

The original obj with the comment attribute set or replaced with comment = plus a src attribute set to alias = and description, seealso, example, and url attributes also possibly populated. If the object is a function, its class becomes aka and function.

Examples

# Say you prefer is.true() similar to is.na() or is.null()
# but R provides isTRUE().
library(svMisc)
# Also defining a short man page
is.true <- aka(isTRUE, description = "Check if an object is TRUE.",
  seealso = c("is.false", "logical"), example = c("is.true(TRUE)", "is.true(FALSE)", "is.true(NA)"))
# This way, you still got access to the right help page for is.true()
if (FALSE) {
.?is.true
}