correctTypes_methods: Convert columns of a data frame to certain types

Description Usage Arguments Value Author(s) Examples

Description

Convert columns of a data frame to certain types

Usage

1
correctTypes(dat, col_names = NULL, types)

Arguments

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 col_names

Value

data.frame. With specified classes.

Author(s)

Kaiyin Zhong, Fan Liu

Examples

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)


Search within the CollapsABEL package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.