Convert all labelled
-class columns to factors.
Source: R/labelled_to_factors.R
labelled_to_factors.Rd
Deprecated. Use the as_factor()
function from the haven
package instead for the same functionality.
Takes a data.frame, checks for columns that are class labelled
from the haven
package, and converts them to factor class.
Examples
tntpr::fake_county |>
haven::as_factor()
#> # A tibble: 39,339 × 38
#> tid fake_data school_year school_code school_name t_male t_race_ethnicity
#> <dbl> <dbl> <dbl> <dbl> <chr> <fct> <fct>
#> 1 100001 1 2014 1303122 Birch Middle Male African American
#> 2 100001 1 2015 1303122 Birch Middle Male African American
#> 3 100002 1 2012 1301958 Kingside Hi… Female White
#> 4 100002 1 2013 1301958 Kingside Hi… Female White
#> 5 100002 1 2014 1301958 Kingside Hi… Female White
#> 6 100002 1 2015 1301958 Kingside Hi… Female White
#> 7 100003 1 2012 1301575 Eliot Eleme… Female White
#> 8 100003 1 2013 1301575 Eliot Eleme… Female White
#> 9 100003 1 2014 1301575 Eliot Eleme… Female White
#> 10 100004 1 2012 1300549 Junction Hi… Male White
#> # ℹ 39,329 more rows
#> # ℹ 31 more variables: t_job_area <fct>, t_salary <dbl>, t_nbpts <dbl>,
#> # t_tenured <dbl>, t_experience <dbl>, t_fte <dbl>, t_highest_degree <fct>,
#> # t_licensed_stem <dbl>, t_eval_obs <fct>, t_eval_growth <fct>, t_stay <dbl>,
#> # t_transfer <dbl>, t_leave <dbl>, t_novice <dbl>, t_new_hire <dbl>,
#> # sch_elem <dbl>, sch_middle <dbl>, sch_high <dbl>, sch_alternative <dbl>,
#> # sch_regular <dbl>, sch_title_1 <dbl>, sch_magnet <dbl>, …