[R] J48 - contrasts can be applied only to factors with 2 or more levels

Patrick Skorupka patsko at gmx.de
Thu Feb 24 15:29:12 CET 2011


Hi everybody,

I recently sent out a first message using this tool and was astonished about the quick and helpful replys. So, thank you in advance for your help, I really appreciate that!

As already recently mentioned I am new to using R as I have to implement some decision trees with R respectively RWeka for my master thesis. I have tried so built some J48 trees and could accomplish first, very basic results. But when I increased the number of independent variables the tree in fact is getting created, but when I try to plot it, R displays “Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") :  contrasts can be applied only to factors with 2 or more levels€. 

I found out that this was apparently due to IVs with only one value and so excluded all these variables from the dataset and double-checked it by using the summary function. Anyway the same error occurs. Anyone any idea? Is there a specific function to test my dataset in this way instead of doing it manually or with the summary function? FYI, the dataset contains 54 attributes, all kind of scales and about 5,000 rows.


-- 
Schon gehört? GMX hat einen genialen Phishing-Filter in die



More information about the R-help mailing list