Description Usage Arguments Value Author(s) Examples
Convert columns of a data frame to certain types
1 | correctTypes(dat, col_names = NULL, types)
|
dat |
data.frame The data frame whose types you want to change. |
col_names |
character. Names of columns, the types of which you want to change. |
types |
character. Names of new types. Should be the same length as |
data.frame. With specified classes.
Kaiyin Zhong, Fan Liu
1 2 3 4 5 6 7 8 9 | ## Not run:
dat = randNormDat(3, 3)
dat[, 2] = as.character(dat$V2)
dat1 = correctTypes(dat, types = rep("numeric", 3))
all(colClasses(dat1) == rep("numeric", 3))
dat2 = correctTypes(dat, 2, "numeric")
all(colClasses(dat2) == rep("numeric", 3))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.