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) ---------------------------------------------------------------------------------------------- On Wed, Jan 26, 2011 at 8:26 PM, Henrique Dallazuanna <www...@gmail.com>wrote: > 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: >> eval(parse(text = all.vars(terms(fit1))[1])) >> >> Which (of course) wouldn't work, since the response variable is only >> available in the data used by rpart (specifically the "kyphosis" dataset) >> >> Thanks upfront. >> >> Tal >> >> >> >> >> ----------------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) >> >> ---------------------------------------------------------------------------------------------- >> >> >> >> >> On Wed, Jan 26, 2011 at 7:40 PM, Henrique Dallazuanna >> <www...@gmail.com>wrote: >> >>> 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 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: >>>> >>>> fit1 <- rpart(Kyphosis ~ Age + Number + Start, data=kyphosis) >>>> fit1$call >>>> fit2 <- rpart(Kyphosis ~ ., data=kyphosis) >>>> fit2$call >>>> >>>> >>>> Is there anything "prettier" then using string manipulation? >>>> >>>> >>>> Thanks. >>>> >>>> >>>> >>>> >>>> >>>> ----------------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) >>>> >>>> ---------------------------------------------------------------------------------------------- >>>> >>>> [[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. >>>> >>> >>> >>> >>> -- >>> Henrique Dallazuanna >>> Curitiba-Paraná-Brasil >>> 25° 25' 40" S 49° 16' 22" O >>> >> >> > > > -- > Henrique Dallazuanna > Curitiba-Paraná-Brasil > 25° 25' 40" S 49° 16' 22" O > [[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.