我的调查信息包含我想清理的自由文本,然后放入事务数据集以在 arules R 包中运行。现在文本看起来像这样。
id | Answers
1 | John thinks that the product is not worth the price
2 | Amy believes that the functionality is well above expectations
这是我正在尝试做的事情:
1 | John | thinks | Product | Not | Worth | Price
1 | Amy | Believes | Functionality | Above | Expectations
现在我已经能够使用tm
包清理数据,但我不知道将其转换为事务数据集的最佳方法是什么。我已将信息全部转换为小写并删除了停用词。
假设我的数据位于名为“问题”的数据框中。清理后,我无法将语料库转换为交易数据集。