[R] rpart space in column names
Raji
raji.sankaran at gmail.com
Mon May 28 06:58:28 CEST 2012
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.
More information about the R-help
mailing list