Used to extract texts from a variable containing numeric values.
attr_to_factor(x)
Object with "map" attributes, where levels and labels exist
Factor
df <- data.frame(cars = 1:3)
attr(df$cars, "map") <-
data.frame(levels = 1:3, labels = c("Volvo", "Saab", "Opel"))
attr_to_factor(df$cars)
#> [1] Volvo Saab Opel
#> Levels: Volvo Saab Opel