> fit.dimer <- rpart(as.factor(out) ~ ., method="class", data=p_df)
>
> fit.dimer$frame[, "var"]
[1] NE WC <leaf> TA <leaf> <leaf> WG WD WW WC
[11] <leaf> <leaf> <leaf> CT <leaf> FC <leaf> YG QT <leaf>
[21] <leaf> <leaf> NW DP DY <leaf> SK <leaf> <leaf> <leaf>
[31] <leaf>
401 Levels: <leaf> AA AC AD AE AF AG AH AI AK AL AM AN AP AQ AR AS AT AV ...
YY
>
> at<-grep("<leaf>", fit.dimer$frame[, "var"], value=FALSE,
ignore.case=TRUE)
>
> fit.dimer$frame[-at, "var"]
[1] NE WC TA WG WD WW WC CT FC YG QT NW DP DY SK
401 Levels: <leaf> AA AC AD AE AF AG AH AI AK AL AM AN AP AQ AR AS AT AV ...
YY
>
> unique(fit.dimer$frame[-at, "var"])
[1] NE WC TA WG WD WW CT FC YG QT NW DP DY SK
401 Levels: <leaf> AA AC AD AE AF AG AH AI AK AL AM AN AP AQ AR AS AT AV ...
YY
HI, Dear R community,
I tried to exact the variables used in tree construction, I used above
codes. Is there a way to remove the "401 levels......"?
How to add " " around each variables? I want them to become "NW", "WC",
etc.
Thanks so much!
--
Sincerely,
Changbin
--
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.