[R] returning argument names

Michael.Scroggie@nre.vic.gov.au Michael.Scroggie at nre.vic.gov.au
Mon Feb 17 23:31:03 CET 2003


Dear r-list folks,

I have a problem which has been bugging me for a while now and I was hoping
someone out there might be able to help.

If I have a user-defined function with an indeterminate number of
arguments, using the well-known "..." construct, how can I get the
function to return the names of the items which were the arguments of the
function as part of the function's output? This is easily done where there
is a fixed number of arguments: e.g:

aa<-c(1,2,3,4,5)
bb<-c(6,7,8,9,10)

argument.out<-function(object1,object2){
name1<-deparse(substitute(object1))
name2<-deparse(substitute(object2))
output<-c(name1,name2)
return(output)
}
argument.out(aa,bb)


How can I produce a similar results from a function where there is an indeterminate number of arguments i.e:

argument.list<-function(object,...){

Any suggestions or solutions would be much appreciated.

Kind regards,


Michael Scroggie




More information about the R-help mailing list