Alternatives for classify_sentiment and classify_polarity in R 3.4.4

package-installation

#1

I am running a code which calculates emotions and polarity in a text.

class_emo = classify_emotion(data$text, algorithm="bayes", prior=1.0)

class_pol = classify_polarity(data$text, algorithm="bayes")

But the updated package 'sentimentr' does not provide both these functions. I tried to install the archived version 'sentiment' from a github link, but after successful installation, the functions still do not work.

How do I resolve this issue? Or which package provides these functions in 3.4.4 version?


#2

Hi @ragas! Welcome!

I'm a little confused by this — it is true that sentimentr is not an updated version of sentiment (they are totally separate packages), so what package are you talking about when you refer to "the updated package"? (or maybe you intended to say something else?)

Can you explain this in more detail? How do you know the installation was successful? What error messages (or other unexpected behavior) do you see when you try to run the lines above?

Note: I believe you are interested in making sentiment — or something equivalent — work with R version 3.4.4., not RStudio (see: Differentiating R from RStudio) — RStudio still hasn't made it past version 1.2 :grin:. I edited the post title accordingly.


#3

@jcblum My bad. Messed up with R and R studio. I am trying to execute example from the following link http://rstudio-pubs-static.s3.amazonaws.com/283869_04d1ed5678d84af68978cf34661d63cf.html.

I tried to install 'sentiment' package by checking for a github link. (stackoverflow posts mentioned that 'classify_emotion and classify_polarity' are available only with 'sentiment' package.)

polarities = classify_polarity(clean_tweets, algorithm='bayes')
I get the following error:
Error in classify_polarity(clean_tweets, algorithm = "bayes") :
could not find function "classify_polarity