apply_columns | R Documentation |
Apply a function to a specified set of columns in a data frame
apply_columns(df, fun, cols, ...)
df |
The data.frame to apply to |
fun |
The function to apply. The first parameter should be the column of data |
cols |
The set of columns to apply to |
... |
Additional parameters to pass into |
A new copy of the data frame with the modified columns
df <- data.frame(one=c("1.0", "2.0"), two=c("3.0", "4.0"))
df <- apply_columns(df, as.numeric, c("one", "two"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.