View source: R/customiseText.R
| customiseText | R Documentation | 
This function styles character vectors or column names in a data frame. The styling function can be customised, or you can provide specific replacements for certain values.
customiseText(
  x,
  fun = function(x) stringr::str_to_sentence(gsub("_", " ", x)),
  custom = NULL,
  keep = NULL
)
x | 
 A character vector to style text.  | 
fun | 
 A styling function to apply to text in   | 
custom | 
 A named character vector indicating custom names for specific
values in   | 
keep | 
 Either a character vector of names to keep unchanged. If NULL, all names will be styled.  | 
A character vector of styled text or a data frame with styled column names.
# Styling a character vector
customiseText(c("some_column_name", "another_column"))
# Custom styling for specific values
customiseText(x = c("some_column", "another_column"),
          custom = c("Custom Name" = "another_column"))
# Keeping specific values unchanged
customiseText(x = c("some_column", "another_column"), keep = "another_column")
# Styling column names and variables in a data frame
dplyr::tibble(
  some_column = c("hi_there", "rename_me", "example", "to_keep"),
  another_column = 1:4,
  to_keep = "as_is"
) |>
  dplyr::mutate(
    "some_column" = customiseText(some_column, custom = c("EXAMPLE" = "example"), keep = "to_keep")
  ) |>
  dplyr::rename_with(.fn = ~ customiseText(.x, keep = "to_keep"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.