I am trying to create a classification tree using either tree or rpart but when it comes to plotting the results the formatting I get is different than what I see in all the tutorials. What I would like to see is the XX/XX format but all I get is a weird decimal value. I was also wondering how you know which is yes and which is no in each leaf of the tree? Is yes always on the left? ******************************** CONFIDENTIALITY NOTICE ******************************** This message (including any attachments) is intended only for the use of the individual or entity to which it is addressed and may contain information that is non-public, proprietary, privileged, confidential, and exempt from disclosure under applicable law or may constitute as attorney work product. If you are not the intended recipient, you are hereby notified that any use, dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, notify us immediately by telephone at (541)343-5641 and (i) destroy this message if a facsimile or (ii) delete this message immediately if this is an electronic communication. Thank you. ********************************
-- begin included message -- I am trying to create a classification tree using either tree or rpart but when it comes to plotting the results the formatting I get is different than what I see in all the tutorials. What I would like to see is the XX/XX format but all I get is a weird decimal value. I was also wondering how you know which is yes and which is no in each leaf of the tree? Is yes always on the left? -- end inclusion --- You will need to give more detail: "all the tutorials" --- certainly not the rpart technical reports, so to what do you refer? "xx/xx format" --- for what? You haven't told us what the response variable is. If you do print(fit) that will help you interpret the result of plot(fit) and text(fit). Terry T
"Brian Jensvold" <bjensvold at hawesfinancial.com> het geskryf>I am trying to create a classification tree using either tree or rpart >but when it comes to plotting the results the formatting I get is >different than what I see in all the tutorials. What I would like to >see is the XX/XX format but all I get is a weird decimal value.The rpart.plot package provides more flexible routines for plotting rpart trees than the rpart package itself. Use rpart.plot with extra=3 to get the XX/XX format you want: library(rpart.plot) data(ptitanic) tree <- rpart(survived ~ ., data=ptitanic) rpart.plot(tree, extra=3) See also page 4 of the vignette for the rpart.plot package.>I was also wondering how you know which is yes and which is no in each >leaf of the tree? Is yes always on the left?rpart.plot annotates the top label with Yes and No to remind viewers that left is yes. To flip that use rpart.plot(tree, extra=3, left=FALSE) But such flipping may not be a good idea -- if your audience is used to plot.rpart they will expect yes on the left.