[R] "Where" command in ctree (party)

Joseph Wang jwang at shopzilla.com
Fri Feb 17 19:57:30 CET 2012


I was able to narrow down to a column that has different types using 

featurefields<-c(7, 17, 19, 20, 22, 33, 35, 36, 38, 44:132)
flag <- rep(0, ncol(data))
for (i in featurefields) {
	flag[i] <- class(data[,i]) != class(validdata[,i])
}


It is an integer class in the training data but is numeric in the validation data even though
unique(valid[,88]) shows 0 and 1.


-----Original Message-----
From: Achim Zeileis [mailto:Achim.Zeileis at uibk.ac.at] 
Sent: Friday, February 17, 2012 10:51 AM
To: Joseph Wang
Cc: r-help at r-project.org
Subject: Re: [R] "Where" command in ctree (party)

On Fri, 17 Feb 2012, josephw wrote:

> i run class(). Both have the same class.

Without a reproducible example it is hard to say what is going on here. 
All columns of the learning and the test data need to have (a) the same name, (b) the same class, (c) the same levels in case they are factors.

> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Where-command-in-ctree-party-tp3264187p4
> 397693.html Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list