Pulling Data fron JnJ and P&G Official Twitter Accounts
Data for this assignment was pulled from using a Twitter API. Each company was looked up by their respective Twitter username (@JnJNews & @ProcterGamble). Tweets from their official accounts spanning from 7/7/2020 to today have been included in the data set. There is a total of 600 data entries and 90 variables for each company used of for final analysis. Sentiment score and text objects were created for final analysis and visuals.
The document is structured with the following sections:
The packages required for this markdown are:
| Package | Summary |
|---|---|
| knitr | Used for RMarkdown documents |
| rmdformats | Used for RMarkdown themes |
| tidyverse | The tidyverse collection of packages all together |
| dplyr | Used for data manipulation |
| ggplot2 | Necessary for creating the visuals used |
| DT | Creating Javascript data tables |
| stargazer | Creating visually appealing summary statistics tables |
| PerformanceAnalytics | Tools for building effective graphics for analytics |
| scales | Used for editting labels on visuals |
| pander | Creates summary tables for Markdown |
| httpuv | Building block for analysis |
| rtweet | Pull Twitter data into R |
| syuzhet | Provides function that helps with Sentiment Analysis |
| SentimentAnalysis | Perform Sentiment Analysis |
| wordcloud | Create word cloud visual |
Looking to each company, I wanted better understand how their audiences interact with their tweets. In particular, I was curious to find our if there was a relationship between the length of a tweet and its respective favorite count (number of likes).
Output shows that when tweets are over 150 characters, there seems to be a positive trend in favorite count. Due to JnJ’s very professional and sometimes very medical content being produced, we could understand how their audience could have a longer attention span and stay engaged.
Output shows us that at around 225 characters P&G begins to see a decrease in favorite count. The company take a different approach to how they carry themselves on Twitter by focusing on linking their household brands to human rights issues. Many of their content focuses on ways to give back, fight injustice and goes beyond talking directly about their products.
Moving into the qualitative data, I wanted to better understand the sentiment of the words JnJ and P&G they use in their tweets.
This analysis interested me because JnJ and P&G both shared ‘positive’ and ‘trust’ as their top 2 scores. Their third sentiment differed, and it showcases how they differ in the sentiments they market to their audiences. While the two companies are similar, it is clear in P&G’s marketing campaigns that they try to capture joy and JnJ has a heightened focus on anticipation as they prioritize their medical innovation.
To do this analysis, individual tweets needed to be condenced into one text value, editted to only contain signular words. Therefore, the data was cleaned to eliminate links, hashtags, punctuation, etc. Below are word cloud for each company.
Another interesting takeaway from these word clouds is that both companies have high usage of the word sorry. You wouldn’t thing they would use a word with a negative connotation in their twitter content, and they don’t. Because both companies have a deep commitment to their consumers, both companies twitter accounts are often replying to customers directly and apologizing for any situations involving their brand.
Through our analysis, we found out that JnJ and P&G tweets have different relationships between their tweet length and favorite count. We also found that both companies have high counts of the saame sentiments. Finally, we were able to see the similarities and diversity of words both companies use in their Twitter language.