s-news
[Top] [All Lists]

identifying which column/row is passed in calls to apply()

To: <s-news@lists.biostat.wustl.edu>
Subject: identifying which column/row is passed in calls to apply()
From: "Schwarz,Paul" <PSchwarz@gcrinsight.com>
Date: Fri, 10 Feb 2006 18:19:09 -0800
Thread-index: AcYusYq1j8CM73U8Sem7FiDu9j26cA==
Thread-topic: identifying which column/row is passed in calls to apply()
S-News readers,

How would I identify which column (or row) is being operated on in a
call to the function specified in apply()? That is, if I wanted to
perform some column-specific (or row-specific) operation, how do I
identify which column/row is being passed to the function that's
specified in the call to apply(), where the number of columns ranges
from 1 to ncol(mymat)?

apply( mymat, 2, function(x){ ? } )


I suspect that this is easy, but I'm drawing a blank on how to do this.

Thanks a lot everyone.

-Paul

<Prev in Thread] Current Thread [Next in Thread>