plotSentimentResponse {SentimentAnalysis} | R Documentation |
Scatterplot with trend line between sentiment and response
Description
Generates a scatterplot where points pairs of sentiment and
the response variable. In addition, the plot addas a trend line
in the form of a generalized additive model (GAM). Other
smoothing variables are possible based on geom_smooth
.
This functions is helpful for visualization the relationship
between computed sentiment scores and the gold standard.
Usage
plotSentimentResponse(
sentiment,
response,
smoothing = "gam",
xlab = "Sentiment",
ylab = "Response"
)
Arguments
sentiment |
|
response |
Vector with response variables of the same length |
smoothing |
Smoothing functionality. Default is |
xlab |
Description on x-axis (default: "Sentiment"). |
ylab |
Description on y-axis (default: "Sentiment"). |
Value
Returns a plot of class ggplot
See Also
plotSentiment
and plot.SentimentDictionaryWeighted
for further plotting options
Examples
sentiment <- data.frame(Dictionary=runif(10))
response <- sentiment[[1]] + rnorm(10)
plotSentimentResponse(sentiment, response)
# Change x-axis
plotSentimentResponse(sentiment, response, xlab="Tone")
library(ggplot2)
# Extend plot with additional layout options
plotSentimentResponse(sentiment, response) + ggtitle("Scatterplot")
plotSentimentResponse(sentiment, response) + theme_void()