Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How To Obtain a Complete Data Frame of Sentiment Values for Pride and Prejudice #40

Open
TerencePatrick opened this issue Dec 26, 2022 · 0 comments

Comments

@TerencePatrick
Copy link

I have just run the following code in RStudio:

install.packages("syuzhet")
install.packages("zoo")

rm(list = ls())
library(syuzhet)
library(zoo)

t1 <- get_text_as_string(path_to_file = "Pride.txt")

get_sentiment(t1)

t1_sentences <- get_sentences(t1)

t1_sentiments <- get_sentiment(t1_sentences)

str(t1_sentiments)
head(t1_sentiments)
#t1_sentences[c(550)]
#options(max.print=1000000)

par(mar=c(2,2,1,1))
simple_plot(t1_sentiments, title = "Pride Sentiments")

t1_window <- round(length(t1_sentiments)*.1)
t1_rolled <- rollmean(t1_sentiments, k = t1_window)
t1_scaled <- rescale_x_2(t1_rolled)

plot(t1_scaled$x, t1_scaled$z, type="l", col="blue", xlab="Narrative Time", ylab="Emotional Valence", main = "Pride and PortraitV1 with Rolling Means")

t1_rolled

In running this code, I get the following message right at the end:

[986] 0.7185185 0.7185185 0.7191919 0.7239899 0.7267677
[991] 0.7313131 0.7302189 0.7348485 0.7389731 0.7388889
[996] 0.7414983 0.7425084 0.7404040 0.7395623 0.7382997
[ reached getOption("max.print") -- omitted 4345 entries ]

Can anyone suggest a modification to the code so that the getOption does not omit any entries and the data frame includes every single entry, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant