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 On Tue, Apr 27, 2010 at 2:46 PM, Erik Iverson <er...@ccbr.umn.edu> wrote: > > > Henrique Dallazuanna wrote: >> >> try this: >> >> apply(veh_drg_animal1[ ,c("readCount","gene_length")] ,1, >> function(x)stats(x[1], x[2], total=55000000)) >> > > I agree with this, that was my point in my original reply. Apply is *not* > passing 2 arguments simply because you are selecting two columns of the > input object, it's passing *one argument*, which is the *entire row* of the > input object. You can then access them individually within the stats > function, as Henrique shows. > ______________________________________________ R-help@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.