Hi all, I'm a newbee using R. I need to do a classification tree using the rpart package. Basically I have a set of birds of known sex and several morphological measurements and we want to predict the sex using the morphology. I read my csv file and it shows up in R no problem, looks fine but when I execute the following rpart command hawkadults_rpart<-rpart(Sex?Footpad+Mean_2ndlength+Bill_length+Tarsus_reg+Mass+Wing_chord,method="class",data=hawkadultsDF) I get the message Error: unexpected input in "hawkadults_rpart<-rpart(Sex?" I feel like as a newbee I'm missing something rather obvious. Any and all help would be greatly appreciated. Thanks -- View this message in context: http://r.789695.n4.nabble.com/unexpected-input-in-rpart-tp3168363p3168363.html Sent from the R help mailing list archive at Nabble.com.
On Thu, Dec 30, 2010 at 07:10:33AM -0800, maysher wrote:> > Hi all, I'm a newbee using R. I need to do a classification tree using the > rpart package. Basically I have a set of birds of known sex and several > morphological measurements and we want to predict the sex using the > morphology. I read my csv file and it shows up in R no problem, looks fine > but when I execute the following rpart command > > hawkadults_rpart<-rpart(Sex?Footpad+Mean_2ndlength+Bill_length+Tarsus_reg+Mass+Wing_chord,method="class",data=hawkadultsDF) > > I get the message Error: unexpected input in "hawkadults_rpart<-rpart(Sex?"The formula in your input contains a tilda character, which is not the ASCII tilda (7E), but some other UTF-8 character (E2 88 BC). For comparison, the two characters are "~" and "?" (in the same order). Which of these two was in your actual R code? In a formula, the ASCII tilda is required. Petr Savicky.
Thanks Petr and yes you are right I had the wrong tilda. I finally figured this out not long after posting my question. I had pulled the wrong tilda from the special characters menu. Thanks again for the help. -- View this message in context: http://r.789695.n4.nabble.com/unexpected-input-in-rpart-tp3168363p3168602.html Sent from the R help mailing list archive at Nabble.com.