add_refmark: Add a Reference Mark to a Character Vector or Matrix

Description Usage Arguments Details Value

View source: R/add_refmark.bare.R

Description

Utility function to add a reference mark to each element of a character vector or matrix. This is an internal function, not intended to be called by package users.

Usage

1
add_refmark(text, textspec, mark, side, raise)

Arguments

text

Character vector or matrix of text strings to be marked.

textspec

Character vector or matrix, parallel to text, indicating whether text already contains a plotmath expression ("plotmath") or markdown ("markdown"), or is plain text ("plain").

mark

Character string to be used as the reference mark.

side

On which side of the text should the reference mark be placed, "before" or "after".

raise

Logical scalar. If TRUE, the reference mark will be displayed as a superscript, using plotmath notation.

Details

If raise is TRUE, every element in the returned text will contain either plotmath or markdown notation. If a text string was originally "plain", the default is to use markdown if the package option allowMarkdown is TRUE, and plotmath otherwise.

It is an error if a "plain" text string contains newline (\n) characters but needs to be converted to plotmath to add a reference mark. (plotmath ignores newline characters.)

If raise is FALSE, the textspec value for each string is the same as on input.

Value

List with components text and textspec. The first will be a character vector or matrix like input text, updated to include the reference mark in each string.

Component textspec will be a character vector or matrix with the same shape as text, and value "plain", "plotmath", or "markdown", according to the contents of text after adding the reference mark.


tablesgg documentation built on June 3, 2021, 1:06 a.m.