View source: R/assignClass2df.R
assignClass2df | R Documentation |
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.
df1 <- matrix(signif(runif(20),4), ncol=2) df2 <- assignClass2df(df1, 2, 'character') str(df1) str(df2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.