Arguments
- .data
A data frame.
- expr
A tidy evaluation expression specifying the columns to use for the new row names.
- .remove
A logical indicating whether to remove the selected columns. Default is FALSE.
- .uniqueSep
A character string to separate duplicate row names when ensuring uniqueness with
make.unique()
. Default is ".".
Examples
library(dplyr)
#>
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
mtcars %>%
head() %>%
mutateToRownames(wt + 3*vs)
#> mpg cyl disp hp drat wt qsec vs am gear carb
#> 2.62 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4
#> 2.875 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4
#> 5.32 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1
#> 6.215 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1
#> 3.44 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2
#> 6.46 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1