Learn R Programming

twidlr (version 0.0.0.9000)

naiveBayes: data.frame-first formula-second method for

Description

This function passes a data.frame, formula, and additional arguments to naiveBayes.

Usage

naiveBayes(data, formula, ...)

# S3 method for naiveBayes predict(object, data, ...)

Arguments

data
Data frame (or object that can be coerced to one) containing the variables in the model
formula
formula (or object that can be coerced to one) describing the model to be fitted
...
Additional arguments to pass to model function
object
Fitted model

See Also

naiveBayes

Examples

Run this code

data <- mtcars
data$cyl_gr_6 <- ifelse(data$cyl > 6, 1, 0)

fit <- naiveBayes(data, cyl_gr_6 ~ .)
summary(fit)

# Help page for function being twiddled
?e1071::naiveBayes

Run the code above in your browser using DataLab