Squish and lowercase all variables in a dataframe
rename_with_stringr.Rd
All variable names in a dataframe will be standardized. The following is applied:
set to lowercase.
whitespace at the end and beginning removed.
whitespace inside of a string set to a single space.
Examples
x <- tibble::tibble(
ChEeSeSteAk = 1:4,
" OH NO " = 4:7,
AHHH = 7:10
)
x |>
rename_with_stringr()
#> # A tibble: 4 × 3
#> cheesesteak `oh no` ahhh
#> <int> <int> <int>
#> 1 1 4 7
#> 2 2 5 8
#> 3 3 6 9
#> 4 4 7 10