Skip to content
Prev 306719 / 398506 Next

Transform pairwise observations into a table

On Oct 1, 2012, at 2:30 PM, arun wrote:

            
That looks a tad ... well, ... complicated. So perhaps these base-only solutions with tapply might be more accessible: Some of them do border on the whimsical, I will admit:

with (dat1, tapply(coef, list(ind1,ind2), I))

with (dat1, tapply(coef, list(ind1,ind2), c))

with (dat1, tapply(coef, list(ind1,ind2), "^", 1))

with (dat1, tapply(coef, list(ind1,ind2), "+", 0))

It is a specific response to the request for a `table`-like function tha twouldallow the application of other functions. Cnage the `1` to `2` in the third instance and you get the tabulated squares. And do not forget the availability of `ftable` to flatten the output of `tapply` retunred values.