Description Usage Arguments Details Value Author(s) Examples

View source: R/splendid_convert.R

Converts all categorical predictors to dummy variables in the dataset. Classification algorithms LDA and the MLR family have such a limitation.

1 | ```
splendid_convert(data, algorithms, convert = FALSE)
``` |

`data` |
data frame with rows as samples, columns as features |

`algorithms` |
character vector of algorithms to use for supervised
learning. See |

`convert` |
logical; if |

If all the variables in the original data are already continuous, nothing is
done. Otherwise, conversion is performed if `convert = TRUE`

. An error
message is thrown if there are categorical variables and `convert = FALSE`

,
indicating exactly which algorithms specified require data conversion.

A (potentially) transformed data frame.

Derek Chiu

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ```
data(hgsc)
# Nothing happens if data is all continuous
data_same <- splendid_convert(hgsc, algorithms = "lda", convert = TRUE)
identical(hgsc, data_same)
# Dummy variables created if there are categorical variables
data_dummy <- splendid_convert(iris, algorithms = "lda", convert = TRUE)
head(data_dummy)
# Some algorithms are robust to the covariate data structure
data_robust <- splendid_convert(iris, algorithms = "rf", convert = FALSE)
identical(iris, data_robust)
# Other algorithms require conversion
## Not run:
splendid_convert(iris, algorithms = "lda", convert = FALSE)
## End(Not run)
``` |

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.