[R] list of variables of an expression

From: Alberto Lusiani <alusiani_at_gmail.com>
Date: Tue, 15 Jun 2010 23:45:39 +0200

I would like to get the list of variables of an expression: is that possible?  I searched the help and the web without success.  In practice, given an expression like

expr = parse(text="x^2+y^3")

I would like to have a function such as:

vars(expr)

returns

c("x", "y") or a list like the one returned by formals().

Regards,

--
Alberto

______________________________________________
R-help_at_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.
Received on Tue 15 Jun 2010 - 21:49:43 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 15 Jun 2010 - 22:20:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive