[R] using tapply with a matrix?
tlumley at u.washington.edu
Mon Mar 24 23:30:44 CET 2003
On Mon, 24 Mar 2003, Nurnberg-LaZerte wrote:
> I've successfully created my own function (topbot) that takes a vector as input and used it with tapply() and an input vector (data$depth) and classification factor (data$profile):
> vols <- tapply(data$depth, data$profile, topbot)
> works great.
> But now I want to do something similar, except my function will take a 3
> column matrix with nrows() equal to the factor's length. tapply doesn't
> like this; I suspect it converts the 3 column matrox into a vector by
> ignoring the DIM atribute.
More information about the R-help