Hi,
    is there a way to convert an rpart tree into ifelese statement that
codes the data withi factors labeled for the tree?

    for e.g.  if Age>50 and group=B,C then 'Age>50 and group=B,C'
                if Age<=50 then group=N,A then 'Age<=50 then group=N,A'

data$tree<-as.factor(ifelse(Age>50 and group in (B,C), 'Age>50 and
group=B,C', ifelse(Age<=50 then group=N,A, 'Age<=50 then group=N,A')))

this way the rpart tree can be used to segment the data by the rule that
does with it to do performance on each tree.

any solution to traverse the rpart tree into if else statement would be
helpful.

thanks
Dhruv








Email transmitted across the Internet is normally not protected and may be 
intercepted and viewed by others. Therefore, you should refrain from sending 
any confidential or private information via unsecured email to PenFed. We will 
not ask you to send confidential information to us via email, such as your 
logon ID, password, account numbers, or Social Security number. We prohibit our 
employees from sending confidential information to you via email that is not 
encrypted. The recommended document submission method is FAX; a partial list of 
generic fax numbers can be found here.


        [[alternative HTML version deleted]]

______________________________________________
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