This mostly happens when the data contain invalid column names (such as all numbers). Try using make.names() on the datasets.
Max On Oct 30, 2011, at 11:35 AM, Luisa Sêco <luisa.s...@gmail.com> wrote: > Dear users, > > I'm using rpart for classification trees, but my code isn't working when I > try to use all the variables in my data frame. This data frame was created > from a data frame with 1775 variables, but I choose only 13. > > arv13<-rpart(iv~.,data=gn,method="class",parms=list(split="information")) > > #Error: > > Error in `[.data.frame`(frame, predictors) : undefined columns selected > > "gn" is a data.frame, so I don't understand where is my mistake. > > If I read the data.frame from a txt file "g13.txt" previously saved, > instead creating the data.frame "gn" from the data frame with 1775 > variables (columns), it works. > > My question is: which properties must the data file have to use rpart doing > "iv ~ ." ? > > Thank you very much, > > My best regards > > Luísa Sêco > <g13.txt> > ______________________________________________ > R-help@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. ______________________________________________ R-help@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.