WhatsApp Chat Sentiment Analysis in R

Visualise Single Continuous Variable

Plot Single Continous Variable Using GGPLOT2 

Step 1: Install and load required packages.

We will be working with BostonHousing data provided by package mlbench

>install.packages("mlbench")
>install.packages("ggplot2")
>library(mlbench)
>library(ggplot2)

Step 2: Plot an area graph using variable 'age'

>ggplot(data = BostonHousing, aes(age))+geom_area(stat = "bin")

Output:

Alter Colour, LineType and LineSize

>ggplot(data = BostonHousing, aes(age))+geom_area(stat = "bin", fill = "dark blue", size = 0.5, linetype = 3, colour = "black")

Output:

Plot a histogram and alter Axis Labels

>ggplot(data = BostonHousing, aes(age)) + geom_histogram(binwidth = 5, fill = "red", size = 0.5, linetype = 1, colour = "black") + xlab("Age") + ylab("Frequency")

Output: