Я использую словарь настроений Trinker для проведения анализа настроений в твитах по ключевым словам. Мне было интересно, как я могу объединить свою таблицу твитов со всей информацией твиттера, озаглавленной Twitter_list, с моей таблицей оценок настроений, озаглавленной Sentiment_Scores?
library(Sentimentr)
library(twitteR)
# SEARCH QUERY
tweets <- searchTwitter("Starbucks", n=1000,lang = "en")
#convert to dataframe
Twitter_list <- twListToDF(tweets)
Output:
text favorited favoritedCount Created
1 Starbucks TRUE 2 2019-01-12
2 starbucks is the FALSE 2 2019-01-11
3 starbucks sucks FALSE 1 2019-01-10
4 Iced starbucks rules FALSE 1 2019-01-09
5 I love starbucks so much True 3 2019-01-08
# Sentiment Score of Text
Sentiment_Scores <- sentiment(Twitter_list$text)
Output:
element_id Sentance_id Word_Count Sentiment
1 1 1 2 0.1856953
2 2 1 5 0.1856953
3 3 1 2 0.1856953
4 4 1 1 0.1856953
5 5 1 3 0.1856953
В идеале я бы хотел, чтобы результат выглядел как
text favorited favoritedCount Created Word_Count Sentiment
1 Starbucks TRUE 2 2019-01-12 1 0.1856953
2 starbucks is the FALSE 2 2019-01-11 3 0.1856953
3 starbucks sucks FALSE 1 2019-01-10 2 0.1856953
4 Iced starbucks rules FALSE 1 2019-01-09 3 0.1856953
5 I love starbucks so much True 3 2019-01-08 5 0.1856953