i am very new to sentiment analysis. I am running the codes based on the tutorial here
It is using a tidytext package. But I encountered the problem when I run the code
AFINN <- sentiments %>%
filter(lexicon == "AFINN") %>%
select(word, afinn_score = score)
AFINN
The error is as below
Error: Problem with `filter()` input `..1`.
✖ object 'lexicon' not found
ℹ Input `..1` is `lexicon == "AFINN"`.
I guess it is because the lexicon column is not in the sentiments dataframe. Or is the tidytext package changed so that i could not run the code the way that the tutorial ran it? is there any other way to correct the code or run another similar code?
Thank you in advance for your clarification.
I followed the same tutorial and had to make the following change
AFINN <- sentiments %>%
filter(lexicon == "AFINN") %>%
select(word, afinn_score = score)
becomes
AFINN <- get_sentiments("afinn") %>%
select(word, afinn_score = value)
Then the rest of the tutorial worked
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.