retype | R Documentation |
retype()
changes the class of specific columns;
retype_all()
changes the class of all columns of a given class.
retype(df, ...)
retype_all(df, from, to)
df |
A |
... |
Unquoted column names, paired with the desired class, e.g.
|
from |
An empty vector of the class to convert from, or a string.
Columns sharing the class of argument |
to |
An empty vector of the class to convert to, or a string.
Columns sharing the class of argument |
Sercan Kahveci
sapply(ToothGrowth,class)
NewToothGrowth <- retype(ToothGrowth, supp = character(), dose = factor())
sapply(NewToothGrowth,class)
sapply(mtcars,class)
newmtcars <- retype_all(mtcars,from="numeric",to="character")
sapply(newmtcars,class)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.