我有一个包含 ID 号列和文本列的数据集,并且我正在使用该quanteda
包对文本数据进行 LIWC 分析。这是我的数据设置的示例:
mydata<-data.frame(
id=c(19,101,43,12),
text=c("No wonder, then, that ever gathering volume from the mere transit ",
"So that in many cases such a panic did he finally strike, that few ",
"But there were still other and more vital practical influences at work",
"Not even at the present day has the original prestige of the Sperm Whale"),
stringsAsFactors=F
)
我已经能够使用scores <- dfm(as.character(mydata$text), dictionary = liwc)
但是,当我查看结果 ( View(scores)
) 时,我发现该函数在最终结果中没有引用原始 ID 号 (19, 101, 43, 12)。相反,包含一row.names
列,但它包含非描述性标识符(例如,“text1”、“text2”):
如何获得dfm()
在其输出中包含 ID 号的功能?谢谢!