[R] Passing values to a function when using apply

Abhishek Pratap abhishek.vit at gmail.com
Tue Apr 27 21:36:45 CEST 2010


Makes sense.

Thanks guys for your quick reverts!
-Abhi

On Tue, Apr 27, 2010 at 3:34 PM, Erik Iverson <eriki at ccbr.umn.edu> wrote:
>
>
> Abhishek Pratap wrote:
>>
>> Hi Guys
>>
>> Thank you for clearing something I dint know. Just wondering the
>> reason of putting the word function(x)  in the apply function when we
>> have already declared stats function separately.
>>
>> I better understand how the arguments are passed.
>>
>> Thanks!
>> -Abhi
>>
>
> That's creating a *new* function, one without a name, that basically "breaks
> up" the x argument into two values, and passes those along with the third
> argument and passes these to your stats function.  You either have to write
> stats to accept two arguments, or leave stats accepting three arguments and
> use this method.
>



More information about the R-help mailing list