我有一個包含ID號碼列和文本列的數據集,並且我正在使用quanteda
包對文本數據運行LIWC分析。這是我的數據設置的例子:在dfm()輸出中包含ID號碼
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)
),我發現功能不引用的LIWC分析最終結果中的原始ID號碼(19,101,43,12)。相反,row.names
列包含但它包含非描述性標識符(例如,「text1」中,「文本2」):
我怎樣才能獲得dfm()
功能,包括在其輸出的ID號?謝謝!
完美,謝謝! – abclist19