Hi: Below works but it's extremely ugly and overly complicated. i'm sure
someone else will send you something better and I'll be waiting also.
Also, the way I named the rows and columns works for below but it won't
hold in the general case if you don't have nice ordered names like
you do below.
xtabs is your friend:
xtabs(likes ~ color + name, data=dat)
color
nameblue green red
jake 1 1 0
sally1 1 0
tom 0 0 1
See ?xtabs for more info. Note that I changed the "likes?" column to
just "likes". It is a bad idea to have question marks in varia
If I have a dataframe which is organized like this:
name color likes?
1 sally red0
2 sally blue1
3 sally green1
4 jake red0
5 jake blue1
6 jake green1
7 tom red1
8 tom blue0
9 tom green0
And I want to create a matrix in the form:
red
3 matches
Mail list logo