Assign a class to a set of column of a data frame. This function is designed to ease the changes of column's class of a given data frame.
assignClass2df(x, colid, cls)
x | a data frame or a R object to be coerced into a data frame. |
---|---|
colid | the identity of columns for which class are ti be changed. |
cls | a character vector containing the classes' names to be used in the
same order as |
A data frame for which columns have the required classes.
#> num [1:10, 1:2] 0.0808 0.8343 0.6008 0.1572 0.0074 ...#> 'data.frame': 10 obs. of 2 variables: #> $ V1: num 0.0808 0.8343 0.6008 0.1572 0.0074 ... #> $ V2: chr "0.8746" "0.1749" "0.03424" "0.3204" ...