ctoc: Categorical variables into Continuous features

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Converting categorical variables into continuous features using the mean of the response variable for the respective categories without using the index record.

Usage

1
ctoc(y, x, data, min.obs)

Arguments

y

Response variable (categorical or continuous).

x

Predictor variables in the dataframe which are categorical and need to be converted into continuous.

data

Name of the dataframe.

min.obs

The minimum number of observations within a category in a categorical variable to get converted into a continuous feature. All the categories which have observations less than the min.obs will form a different category.

Details

This function is only for categorical variables.

Value

Returns a dataframe with converted features without replacing the original ones.

Author(s)

Santhosh Sasanapuri

See Also

apply.ctoc, tbin, apply.tbin.

Examples

1
2
3
4
5
data(ChickWeight)
# Converting the "Chick" variable into factor from ord.factor for demonstration purposes.
ChickWeight$Chick <- as.factor(as.numeric(ChickWeight$Chick))
# Returns a dataframe with two added columns for "Chick" and "Diet"
head(ctoc(y = "weight", x = c("Chick","Diet"), data = ChickWeight, min.obs = 12))


Search within the corkscrew package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.