R arulesSequences - which frequent sequences are present in a transaction?

寵の児 提交于 2019-12-03 16:50:52

To see whether each sequence is present or not you can indeed use your provided code:

sequences_score <- as.matrix(sequences@tidLists@data)

However, you have to map the resulting matrix to your data using another property of your sequence object as follows:

# Get mapping ids, change to numeric values
mapping_ids      <- as.numeric(sequences@tidLists@transactionInfo$sequenceID)

# Then map your matrix sequence_score to correspond to the order of your data
sequences_score  <- sequences_score[order(mapping_ids), ]
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!