【发布时间】:2021-10-05 10:46:38
【问题描述】:
我想使用两个数据框在 R 中创建一个文档术语。
例如,第一个数据框包含文本。
df1
category text
person1 "hello word I like turtles"
person2 "re: turtles! I think turtles are stellar!"
person3 "sunflowers are nice."
第二个数据框有一列包含所有感兴趣的术语。
df2
col1 term
x turtles
y hello
w sunflowers
f I
生成的矩阵将显示每个人对df2$terms 中每个单词的使用。
结果
category turtles hello sunflowers I
person1 1 1 0 1
person2 2 0 0 1
person3 0 0 1 0
帮助!
【问题讨论】: