transform_data: transform_data

Description Usage Arguments Value Examples

View source: R/transform_data.R

Description

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.

Usage

1

Arguments

X

input X, it should be a data.frame object with colnames.

Value

it will return a new dataset which is desirable for linear_regression function.

Examples

1
2
library(carData)
transform_data(Salaries)

keyuchen886/OLSregression documentation built on Jan. 1, 2021, 7:17 a.m.