library(C50)
library(printr)

This code takes a sample of 100 rows from the iris dataset:

train.indeces <- sample(1:nrow(iris), 100)
iris.train <- iris[train.indeces,]
iris.test <- iris[-train.indeces,]

This code trains a model based on the training data:

model <- C5.0(Species ~ ., data = iris.train)

This code tests the model using the test data:

results <- predict(object = model, newdata = iris.test, type = "class")

This code generates a confusion matrix for the results:

table(results, iris.test$Species)
results/ setosa versicolor virginica
setosa 14 0 0
versicolor 1 13 0
virginica 0 1 21