我正在使用 quanteda 构建两个文档特征矩阵:
library(quanteda)
DFM1 <- dfm("this is a rock")
# features
# docs this is a rock
# text1 1 1 1 1
DFM2 <- dfm("this is music")
# features
# docs this is music
# text1 1 1 1
但是,我希望 DFM2 具有一组特定的功能,即来自 DFM1 的功能:
DFM2 <- dfm("this is music", *magicargument* = featnames(DFM1))
# features
# docs this is a rock
# text1 1 1 0 0
有没有我想念的魔法论据?还是有另一种有效的方法来为大袋的词存档?