[R] list of variables of an expression

Alberto Lusiani alusiani at gmail.com
Tue Jun 15 23:45:39 CEST 2010


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



More information about the R-help mailing list