Description Usage Arguments Value Examples
View source: R/transform_data.R
In linear regression, or in most of machine learning models, it's import to encode your categorical data. In this transform_data function, we encode categorical variable by creating n-1 new variables as indicator, and the last one is the base level. For example, if a feature sex has only two type: male or female, then we will generate Sexmale feature, which is 1 if the sex is male, 0 otherwise. In fact, this function is used internally in linear_regression() function to change dataframe.
1 |
X |
input X, it should be a data.frame object with colnames. |
it will return a new dataset which is desirable for linear_regression function.
1 2 | library(carData)
transform_data(Salaries)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.