[R] extract argument names

roger koenker rkoenker at uiuc.edu
Tue Apr 7 21:26:45 CEST 2009


I have a vector of character strings that look like R expressions:

 > a <- paste("qss(",paste("x",1:6,sep = "") ,", lambda =100)", sep =  
"")
 > a
[1] "qss(x1, lambda =100)" "qss(x2, lambda =100)" "qss(x3, lambda =100)"
[4] "qss(x4, lambda =100)" "qss(x5, lambda =100)" "qss(x6, lambda =100)"

That I would like to operate on to obtain the names of the first  
argument, i.e.

 > foo(a)
[1] "x1" "x2" "x3" "x4" "x5" "x6"

I thought there was some simple idiom involving deparse, but it is  
eluding
my searches.


url:    www.econ.uiuc.edu/~roger            Roger Koenker
email    rkoenker at uiuc.edu            Department of Economics
vox:     217-333-4558                University of Illinois
fax:       217-244-6678                Champaign, IL 61820




More information about the R-help mailing list