Learn R Programming

SentimentAnalysis (version 1.3-4)

plot.SentimentDictionaryWeighted: KDE plot of estimated coefficients

Description

Function performs a Kernel Density Estimation (KDE) of the coefficients and then plot these using ggplot. This type of plot allows to inspect whether the distribution of coefficients is skew. This can reveal if there are more positive terms than negative or vice versa.

Usage

# S3 method for SentimentDictionaryWeighted
plot(x, color = "gray60", theme = ggplot2::theme_bw(), ...)

Value

Returns a plot of class ggplot

Arguments

x

Dictionary of class SentimentDictionaryWeighted

color

Color for filling the density plot (default: gray color)

theme

Visualization theme for ggplot (default: is a black-white theme)

...

Additional parameters passed to function.

See Also

plotSentiment and plotSentimentResponse for further plotting options

Examples

Run this code
d <- SentimentDictionaryWeighted(paste0(character(100), 1:100), rnorm(100), numeric(100))
plot(d)

# Change color in plot
plot(d, color="red")

library(ggplot2)
# Extend plot with additional layout options
plot(d) + ggtitle("KDE plot")
plot(d) + theme_void() 

Run the code above in your browser using DataLab