[R] Extract the names of the arguments in an "expression"

Gabor Grothendieck ggrothendieck at gmail.com
Thu Mar 24 13:37:47 CET 2011


2011/3/24 Javier López-de-Lacalle <javier.lopezdelacalle at ehu.es>:
> Hi everybody:
>
> I need to get the names of the arguments in an object of class "expression".
> I've got the following expression:
>
>> x <- expression(rho * cos(omega))
>
> Is there any function or procedure that returns the names of the arguments
> (in the example: "rho" and "omega")?
>

Try this:

> all.vars(x)
[1] "rho"   "omega"

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list