Imagine that you have a dataset with a list of predictors or independent variables and a list of targets or dependent variables. Then, by applying a decision tree like J48 on that dataset would allow you to predict the target variable of a new dataset record. 

Decision tree J48 is the implementation of algorithm ID3 (Iterative Dichotomiser 3) developed by the WEKA project team. R includes this nice work into package RWeka. 

Let’s use it in the IRIS dataset. Flower specie will be our target variable, so we will predict it based on its measured features like Sepal or Petal length and width among others.

# If not already, we should start by installing “RWeka” and “party” Packages

> install.packages(RWeka)

> install.packages(party)

# Load both packages

> library(RWeka)

> library(party)

# We will use dataset ‘IRIS’ from package ‘datasets’. It consists of 50 objects from each of three species of