a, b, c
b, c, d
d, e, f
こういうアイテムリストが並んでいるデータを
a b c d e f
1 1 1 1 0 0 0
2 0 1 1 1 0 0
3 0 0 0 1 1 1
こういう0と1の行列に変換したい。
Rのarulesパッケージを使うと簡単にできるようだ。
require(arules)
tran <- read.transactions("trans.txt", sep=",", format="basket")
mat1 <- as(tran, "matrix")
head(mat1)
参考
http://tjo.hatenablog.com/entry/2014/03/20/190000
http://qiita.com/hidetarou2013@github/items/dc3b448542c5fce7a6ce#matrix_convert