r - Tab Delimited to Square Matrix -
I have a tab delimited file like
AB 0.5 AC 0.75 BD 0.2
and I want to convert it into a square matrix, such as
ABCDA 0 0.5 0.75 0 B 0 0.2 cD
< / Ex>How can I go about this in R? Thank you,
If you have the following column name of data in the data frame:
var1 var2 value
xtabs (value ~ Var1 + var2, data = df)
<
Comments
Post a Comment