R/labelled.R
str_replace_all_var_labels.RdUpdate variable labels - replace a string for all variable labels.
str_replace_all_var_labels(df, pattern, replacement)A data frame
Pattern to look for.
The default interpretation is a regular expression, as described
in stringi::stringi-search-regex. Control options with
regex().
Match a fixed string (i.e. by comparing only bytes), using
fixed(). This is fast, but approximate. Generally,
for matching human text, you'll want coll() which
respects character matching rules for the specified locale.
A character vector of replacements. Should be either
length one, or the same length as string or pattern.
References of the form \1, \2, etc will be replaced with
the contents of the respective matched group (created by ()).
To perform multiple replacements in each element of string,
pass a named vector (c(pattern1 = replacement1)) to
str_replace_all. Alternatively, pass a function to
replacement: it will be called once for each match and its
return value will be used to replace the match.
To replace the complete string with NA, use
replacement = NA_character_.
A data frame
Other Labelled data utility functions:
capitalise_first_letter_var_labels(),
str_remove_from_var_labels()