View source: R/fp_extract_labeltext.R
| fp_extract_labeltext | R Documentation |
Build a labeltext data frame from selected columns. This helper supports both tidyselect syntax and explicit character column names.
fp_extract_labeltext(x, ..., cols = NULL, names = NULL, na = "")
x |
A data frame (grouped or ungrouped). |
... |
Columns selected using tidyselect syntax. |
cols |
Optional explicit character vector of column names. Cannot be
combined with |
names |
Optional replacement names for the extracted columns. |
na |
Replacement value for missing values in atomic scalar cells. |
For grouped data frames, extraction follows the grouped forestplot row alignment logic so that label rows correspond to the first grouped estimate panel.
A data frame suitable for labeltext in forestplot().
data(inventors_vs_mello)
# ungrouped selection with explicit columns
fp_extract_labeltext(
inventors_vs_mello,
cols = c("author", "ai", "n1i", "ci", "n2i", "orci"),
names = c("Study", "E1", "N1", "E2", "N2", "OR"),
na = ""
)
# grouped extraction follows grouped forestplot row alignment
# (rename estimate columns to mean/lower/upper for grouped extraction)
inventors_vs_mello |>
dplyr::rename(mean = est, lower = lb, upper = ub) |>
dplyr::group_by(group) |>
fp_extract_labeltext(author, orci, na = "")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.