Hi,

Our data has column names with spaces in that.The names in dataFrame are,
    *[1] "Sepal Length" "Sepal Width"  "Petal Length" "Petal Width" 
"Species" *
When i try to use the column names in rpart function, it gives the following
error.
*   rp<-rpart(as.factor(`Species`)~`Sepal Length`)
Error in `[.data.frame`(frame, predictors) : undefined columns selected*

But , a similar call works for kmeans/nnet functions.For example,
  *nn<-nnet(as.factor(`Species`)~`Sepal Length`,size=3)*

Is there any way in which column names with spaces be used in rpart function
like being used in nnet/kmeans function?

Thanks in advance for your help,
Raji

--
View this message in context: 
http://r.789695.n4.nabble.com/rpart-space-in-column-names-tp4631557.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.

Reply via email to