Skip to contents

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.

Usage

rename_with_stringr(.data)

Arguments

.data

A Dataframe.

Value

A Dataframe with the modified variable names.

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