I am a beginner to use R. I am trying to create a decision table on the basis of the chi-square test. I have taken a decision table with 10 columns and apply chi- square test between condition attributes (V1 to V9) and decision attribute(V10). if the chi-square value is less than 0.05, I have taken that particular column. finally, I have created a decision table with columns which have chi-square value less than 0.05.
CODE:
decision.table <-SF.read.DecisionTable(filename = "style.dat", decision.attr = 10, indx.nominal = c(1, 10), stringsAsFactors=FALSE)
newdata<-0
for(i in 1:9)
{
tbl = table(decision.table[,i], decision.table[,10])
tabt<-chisq.test(tbl)
if(tabt[[3]]<0.05)
{
newdata<-decision.table[c(i)]
}
print(newdata)
}
It shows single column at a time. i want a complete table with all column which have chisquare value less than 0.05.