| num_pad | R Documentation |
num_pad() adds spaces to the left or right of each element of a text
vector so that all elements have the same width, counted in characters or
measured in a font. align_chr() uses it to line up numbers.
num_pad(
x,
pad_left = TRUE,
padding_character = " ",
NA_value = "",
font_family = NULL
)
x |
vector of text |
pad_left |
if TRUE (default), pads on the left, otherwise pads on the right |
padding_character |
character to use for padding, default is |
NA_value |
value to replace NA |
font_family |
font in which to measure text widths. If |
By default, text is padded with one padding_character per missing visible character. Markdown markup (e.g., **, *, ^, ~, and backslash escapes) is not counted. If font_family names an installed font, text is instead padded to equal rendered width in that font, using a combination of figure, punctuation, thin, and hair spaces (padding_character is then ignored). Superscripts and subscripts are measured at 2/3 of the font size.
character vector
num_pad(c("a", "bb"))
# A minus sign (U+2212) and a figure-space-padded 1 have the same width
num_pad(c("\u22121", "1"), font_family = "Times New Roman")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.