I have often had to write functions myself to create the facet titles or table titles for a combination of name-value pairs. See example below.
Is there a function somewhere that can do this? Perhaps with more options and generalizability?
library(tidyverse)
to_label <- function(x) {
map2(names(x), x, str_c, sep = "=") %>% str_c(collapse = ", ")
}
list(a = 1, b = "two", c = FALSE) %>% to_label()
#> [1] "a=1, b=two, c=FALSE"
Created on 2022-01-11 by the reprex package (v2.0.1)