prefix: Formattable object with prefix

Description Usage Arguments Examples

View source: R/formats.R

Description

Formattable object with prefix

Usage

1
prefix(x, prefix = "", sep = "", ..., na.text = NULL)

Arguments

x

an object

prefix

a character vector put in front of each non-missing value in x as being formatted.

sep

separator

...

additional parameter passed to formattable.

na.text

text for missing values in x.

Examples

1
2
3
4
5
prefix(1:10, "A")
prefix(1:10, "Choice", sep = " ")
prefix(c(1:10, NA), prefix = "A", na.text = "(missing)")
prefix(rnorm(10, 10), "*", format = "d")
prefix(percent(c(0.1,0.25)), ">")

Example output

 [1] A1  A2  A3  A4  A5  A6  A7  A8  A9  A10
 [1] Choice 1  Choice 2  Choice 3  Choice 4  Choice 5  Choice 6  Choice 7 
 [8] Choice 8  Choice 9  Choice 10
 [1] A1        A2        A3        A4        A5        A6        A7       
 [8] A8        A9        A10       (missing)
 [1] *8  *11 *9  *9  *10 *11 *11 *11 *11 *10
[1] >10.00% >25.00%

formattable documentation built on Jan. 13, 2021, 7:17 a.m.