Make a column into a list column
Usage
add_list_column(
data,
...,
type = c("1", "a", "A", "I", "i"),
sep = ". ",
merge = FALSE
)Arguments
- data
data.frame or tibble
- ...
Column name or tidyselect function. Select columns. Default is first column
- type
list type:
"1"(default) for 1, 2, 3;"a"for a, b, c;"A"for A, B, C;"i"for i, ii, iii; or"I"for I, II, III- sep
text between the list label and the item (default:
". ", as in "1. ")- merge
If
TRUE, list columns will be united with their respective text columns.
Examples
d <- data.frame(x = letters[1:5], y = letters[2:6])
# default is first column
add_list_column(d) |>
apa_flextable()
x
y
1.
a
b
2.
b
c
3.
c
d
4.
d
e
5.
e
f
# select any column
add_list_column(d, y) |>
apa_flextable()
x
y
a
1.
b
b
2.
c
c
3.
d
d
4.
e
e
5.
f
add_list_column(d, type = "a", sep = ") ") |>
apa_flextable()
x
y
a)
a
b
b)
b
c
c)
c
d
d)
d
e
e)
e
f
add_list_column(d, merge = TRUE)
#> x y
#> 1 1. a b
#> 2 2. b c
#> 3 3. c d
#> 4 4. d e
#> 5 5. e f