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

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

1 |

`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. |

This function is only for categorical variables.

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

Santhosh Sasanapuri

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))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.