It improves the performance of converting several types of variables.
Examples
lifeexp %>%
dplyr::mutate(
region_chr = as_character(region),
region_num = as_numeric(region),
region_fct = haven::as_factor(region),
.keep = "used"
)
#> # A tibble: 68 × 4
#> region region_chr region_num region_fct
#> <dbl+lbl> <chr> <dbl> <fct>
#> 1 1 [Europe & C. Asia] Europe & C. Asia 1 Europe & C. Asia
#> 2 1 [Europe & C. Asia] Europe & C. Asia 1 Europe & C. Asia
#> 3 1 [Europe & C. Asia] Europe & C. Asia 1 Europe & C. Asia
#> 4 1 [Europe & C. Asia] Europe & C. Asia 1 Europe & C. Asia
#> 5 1 [Europe & C. Asia] Europe & C. Asia 1 Europe & C. Asia
#> 6 1 [Europe & C. Asia] Europe & C. Asia 1 Europe & C. Asia
#> 7 1 [Europe & C. Asia] Europe & C. Asia 1 Europe & C. Asia
#> 8 1 [Europe & C. Asia] Europe & C. Asia 1 Europe & C. Asia
#> 9 1 [Europe & C. Asia] Europe & C. Asia 1 Europe & C. Asia
#> 10 1 [Europe & C. Asia] Europe & C. Asia 1 Europe & C. Asia
#> # ℹ 58 more rows