Convert a numeric vector to a vector of numbered labels
Source:R/as_numbered_labels.R
as_numbered_labels.Rd
This function allows the creation of numbered labels for a vector using a range of numbering styles.
Usage
as_numbered_labels(
x,
labels = "arabic",
start = NULL,
suffix = NULL,
base = 26,
cols = "num_label",
pad = NULL,
side = "left",
quiet = TRUE,
call = parent.frame()
)
Arguments
- x
An integer or other vector or a data.frame. An integer vector or integer column is used as the number that is converted based on the label style. If x is not an integer or data.frame with an integer column, the numbering is created based on
seq_along()
.- labels
Label style. Options include "arabic", "alph", "Alph", "alpha", "Alpha", "roman", or "Roman".
- start
Starting number or value. Letters are supported if label style is "alph", "Alph", "alpha", or "Alpha" and Roman numerals are supported if label is "roman" or "Roman".
- suffix
Suffix character to follow number labels. For example, if
x = 1
andsuffix = "."
the returned label would be "1."- base
Base used in alphabetical number labels. Highest letter to use for alphabetical numbers. Single digit letters (A to Z) or numbers 1 to 26 are supported. For example, if base is 3, alphabetical labels for numbers higher than 3 have the prior value prefixed so 3 would be "C" and 4 would be "AA". Defaults to 26 which converts 27 to "AA", 53 to "BA", etc.
- cols
Column name to use for added column for number labels when x is a data.frame. Defaults to "num_label". If cols is length 2, the first item in the vector is assumed to be the column name from the data.frame to use as x and the second item is used as the column name for the added column with number labels.
- pad, side
If pad is not
NULL
, pass pad and side tostr_pad()
added from thestringstatic::str_pad()
package.- quiet
If
TRUE
, suppress warnings about creation of NA values through coercion of object types. Default toTRUE
.- call
Default:
parent.frame()
. Passed to input checking functions to improve error message traceback.