I would like to convert my dataframe into a matrix that expands a single factor column into multiple ones and assigns a 1/0 depending on the factor. Fo
1
0
Let's call your data.frame df:
df
library(reshape2) dcast(df,C2*C3~C1,fill=0,length) C2 C3 A B 1 1 1 1 0 2 3 4 0 1 3 3 5 1 0