the code that I used is given below and the error displayed also Data is present at
https://data.gov.in/catalog/historical-daily-ambient-air-quality-data
and download only Delhi data for 2015
//Importing the data
library(readxl)
aq_delhi_2015 <- read_excel("C:/Users/NAMIT/Desktop/aq_delhi-2015.xlsx")
//View the data
View(aq_delhi_2015)
//Subsetting the data for the station code=55
delhi1 <- subset(aq_delhi_2015,aq_delhi_2015```
Stn Code`=="55")
//view the dataset Delhi1
View(delhi1)
//Importing the necessary packages
library("RWeka", lib.loc="~/R/win-library/3.5")
library("party", lib.loc="~/R/win-library/3.5")
//Creating the decision tree
tree1 <- J48(delhi1$'Stn Code`~.,data = delhi1)
//Error Error in .jcall(o, "Ljava/lang/Class;", "getClass") :weka.core.UnsupportedAttributeTypeException: weka.classifiers.trees.J48: Cannot handle string attributes!
It's difficult to reproduce the example when you have to go through hoops to get the source data.
My first suggestions is the use the C50
package. It is an updated version of Quinlan's algorithm that doesn't use Java.
Suggestions #2: Change the formula to remove the data frame name and use two back-ticks (you code had a quote character and a back-tick character).
tree1 <- J48(`Stn Code` ~ ., data = delhi1)