[R] Function argument as string

From: Vishwanath Sindagi <vishur6_at_gmail.com>
Date: Wed, 16 Jun 2010 21:00:15 +0530


Hi,

Suppose a write a function

a_fn<-function(arg1)
{

    return(table(arg1));
}

I have a column called AGE. Now I call the function c = a_fn(AGE);

When a_fn is called, AGE is received in arg1. My question is, how do I access the actual name of the argument arg1? i.e, inside the function, i need to know that the actual name of arg1 is "AGE" in this case.

Thanks in advance,
Vishwanath



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 Wed 16 Jun 2010 - 19:33:29 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 Wed 16 Jun 2010 - 19:50: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