| column_spanner_label | R Documentation |
Prepend column spanner labels to data column labels
column_spanner_label(data, label, ..., relocate = TRUE)
data |
data.frame or tibble |
label |
character of column spanner |
... |
columns (i.e., one or more tidyselect functions and/or a vector of quoted or unquoted variable names) |
relocate |
relocate columns with same spanner label to be adjacent |
data.frame or tibble
d <- data.frame(y = 1:3, x1 = 2:4, x2 = 3:5)
# Unquoted variable names
column_spanner_label(d, "Label", c(x1, x2))
# Character values (quoted variable names)
column_spanner_label(d, "Label", c("x1", "x2"))
# Tidyselect function (e.g., starts_with, ends_with, contains)
column_spanner_label(d, "Label", dplyr::starts_with("x"))
# Tidyselect range
column_spanner_label(d, "Label", x1:x2)
# Selected variables are relocated after the first selected variable
column_spanner_label(d, "Label", c(x2, y))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.