Perfect. Thanks Erik.
On Thu, Jun 17, 2010 at 1:07 AM, Erik Iverson wrote:
>
>
> Vishwanath Sindagi wrote:
>>
>> 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);
>>
>> W
Try
# data
AGE <- rpois(25, 30)
# option 1
foo <- function(string) table(get(deparse(substitute(string
foo(AGE)# no quotes
# option 2
foo2 <- function(string) table(get(string))
foo2('AGE') # note the quotes here
HTH,
Jorge
On Wed, Jun 16, 2010 at 11:30 AM, Vishwanath Sindagi <> wrot
Vishwanath Sindagi wrote:
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?
3 matches
Mail list logo