i have a list of words, freq, and affinity lexicon and am trying to count and group, but not sure how to include the frequency in the code. each of these 2 lines works except not counting the freq column in the addition and i'm not sure how to do that.
ddply(summaryLex,~sentiment,summarise,frequency=length(unique(word)))
sqldf("SELECT sentiment, COUNT(sentiment) as totalsent from summaryLex GROUP BY sentiment")
summaryLex csv file][1]
summaryLex File:
[ ][2 ] https://drive.google.com/open?id=15KBebiqXsNnndOP2mzoaxnvx1nk8Z8vL
if data.table:
data[, sum(freq), by = sentiment]
if dplyr:
data %>%
group_by(sentiment) %>%
summarise(sum = sum(freq))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.