[R] Extracting the terms from an rpart object

2011-01-26 Thread Tal Galili
Hello all, I wish to extract the terms from an rpart object. Specifically, I would like to be able to know what is the response variable (so I could do some manipulation on it). But in general, such a method for rpart will also need to handle a . case (see fit2) Here are two simple examples:

Re: [R] Extracting the terms from an rpart object

2011-01-26 Thread William Dunlap
tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Tal Galili Sent: Wednesday, January 26, 2011 9:33 AM To: r-help@r-project.org Subject: [R] Extracting the terms from an rpart object Hello all, I wish to extract

Re: [R] Extracting the terms from an rpart object

2011-01-26 Thread Henrique Dallazuanna
Try this: all.vars(terms(fit1)) all.vars(terms(fit2)) On Wed, Jan 26, 2011 at 3:33 PM, Tal Galili tal.gal...@gmail.com wrote: Hello all, I wish to extract the terms from an rpart object. Specifically, I would like to be able to know what is the response variable (so I could do some

Re: [R] Extracting the terms from an rpart object

2011-01-26 Thread Tal Galili
Thanks Henrique, exactly what I was looking for. Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English)

Re: [R] Extracting the terms from an rpart object

2011-01-26 Thread Tal Galili
Another (similar) question, If I now want to know the name of the data argument used, is there an easy way for me to access it? I'm trying to use something like: eval(parse(text = all.vars(terms(fit1))[1])) Which (of course) wouldn't work, since the response variable is only available in the

Re: [R] Extracting the terms from an rpart object

2011-01-26 Thread William Dunlap
: r-help@r-project.org Subject: Re: [R] Extracting the terms from an rpart object Thanks Henrique, exactly what I was looking for. Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me

Re: [R] Extracting the terms from an rpart object

2011-01-26 Thread Henrique Dallazuanna
Try this: as.character(as.list(fit1$call)$data) On Wed, Jan 26, 2011 at 4:12 PM, Tal Galili tal.gal...@gmail.com wrote: Another (similar) question, If I now want to know the name of the data argument used, is there an easy way for me to access it? I'm trying to use something like:

Re: [R] Extracting the terms from an rpart object

2011-01-26 Thread Tal Galili
Exactly what I needed Henrique, Thank you. Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English)

Re: [R] Extracting the terms from an rpart object

2011-01-26 Thread William Dunlap
From: Tal Galili [mailto:tal.gal...@gmail.com] Sent: Wednesday, January 26, 2011 11:35 AM To: Henrique Dallazuanna Cc: r-help@r-project.org; William Dunlap Subject: Re: [R] Extracting the terms from an rpart object