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. I can't apply the funtion to each column separately as I need the info in all three simultaneously for the function's results. I could always revert to "for" loops but was looking for a more concise solution in the spirit of "R". Thanks in advance for any suggestions, Bruce L. ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
