fix_coltypes | R Documentation |
Sometimes things that should be numbers get interpreted as strings (e.g. 1 vs. "1"). This function automatically inferred the best match for each column and reformats its column type accordingly.
fix_coltypes(dat)
dat |
A data.frame. |
A fixed data.frame
dat <- mtcars
dat$cyl <- as.character(dat$cyl)
dat$wt <- as.character(dat$wt)
dat$drat <- as.factor(dat$drat)
dat2 <- fix_coltypes(dat=dat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.