- R (preferably version 3.2.3 or higher)
- A WhatsApp chat in plain text format
- Export your Whatsapp chat history: http://www.whatsapp.com/faq/general/23753886
- Download the attachment.
- Replace the path given here with your desired path.
whatsappRaw <- read.table("WhatsApp Chat with CSE Junior Year.txt", header=FALSE,fill = TRUE)
library(dplyr)
whatsappDF <- tbl_df(whatsappRaw)
head(whatsappDF)
Selecting only the names of the recipients (the data frame is loaded in the form of columns from V1:V20):
select(whatsappDF,V5)
The wordcloud of the words present in the chat was generated in the following way:
library(wordcloud)
wordcloud(whatsappDF$V5, random.order = FALSE, max.words = 100, col = brewer.pal(7,"Accent"))
The sentiment comparison cloud of the words present in the chat was generated in the following way:
tidyWA %>% inner_join(get_sentiments("bing")) %>% count(word, sentiment, sort = TRUE) %>% acast(word ~
sentiment, value.var = "n", fill = 0) %>% comparison.cloud(
colors = c("#F8766D", "#00BFC4"),
max.words = 100,
scale = c(3, 0.5)
)
)
- Create a shiny web app