Skip to content
Prev 285723 / 398502 Next

transforming a data frame to matrix

On Feb 18, 2012, at 8:35 AM, Adel ESSAFI wrote:

            
Perhaps:

xtabs(C ~ A + B, data=dfrm)

There will be an implicit summation of C-values in the presence of  
duplicates. For the application of other functions, you would use  
tapply. This untested code might give you counts:

with(dfrm, tapply(C, list(A, B), length)