View source: R/e_data_convert_factor_to_numeric.R
e_data_convert_factor_to_numeric | R Documentation |
When saving to csv, the default data class/type for factors is the character labels. This function replaces those with the numeric factor levels.
e_data_convert_factor_to_numeric(dat)
dat |
data.frame or tibble |
dat with factor variables converted to numeric
dat <- dat_mtcars_e
str(dat)
dat2 <- dat |> e_data_convert_factor_to_numeric()
str(dat2)
# readr::write_csv(x = dat , file = "dat.csv" )
# readr::write_csv(x = dat2, file = "dat_num.csv")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.