columns_to_factors | R Documentation |
Function to convert a data frame with two or more columns of numerical values, where each column corresponds to a specific factor level, into two columns, where the first column contains all of the numerical values and the second column contains their corresponding factor level.
columns_to_factors(
data,
response.name = NULL,
factor.name = NULL,
level.names = NULL
)
data |
the data frame containing the (two or more) numerical columns. |
response.name |
the name for the response column in the new data frame |
factor.name |
the name for the factor (categorical variable) column in the new data frame |
level.names |
a vector containing the desired names for the factor levels. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.