setColClass | R Documentation |
This function is designed to ease the changes of column's class of a given data frame.
setColClass(x, colid, cls)
x |
a data frame or an R object to be coerced into a data frame. |
colid |
the identity of columns for which class are to be changed. |
cls |
a character vector containing the classes' names to be used in the
same order as |
A data frame whose columns have the desired classes.
df1 <- matrix(signif(runif(20),4), ncol=2) df2 <- setColClass(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.