Arranges columns alphabetically and then by type
The user can supply a tidyselect argument to specify columns that should come first
relocate_all(.data, ..., regex = NULL)
Arguments
- .data
data frame
- ...
a tidyselect specification
- regex
a regular expression to match columns that will be put at the front of the df
Examples
iris %>%
head %>%
relocate_all(matches("Petal"))
#> Species Petal.Length Petal.Width Sepal.Length Sepal.Width
#> 1 setosa 1.4 0.2 5.1 3.5
#> 2 setosa 1.4 0.2 4.9 3.0
#> 3 setosa 1.3 0.2 4.7 3.2
#> 4 setosa 1.5 0.2 4.6 3.1
#> 5 setosa 1.4 0.2 5.0 3.6
#> 6 setosa 1.7 0.4 5.4 3.9