Get startedGet started for free

Twitter user analysis

1. Twitter user analysis

Analyzing twitter user data provides vital information which can help leverage the power of social media.

2. Lesson Overview

In this lesson, we will analyze user information using two approaches: We will use friends_count and followers_count to derive the golden ratio and interpret it for brand promotion. Next, we will use twitter lists to identify users interested in a product.

3. Followers vs friends

For the first approach, let's understand the concepts of friends and followers. Followers are other users following a twitter user. Friends are people the specific user is following on twitter.

4. Twitter follower vs following ratio

follower vs following ratio, also called the golden ratio, is the ratio of followers_count to friends_count. The golden ratio is used by marketers to strategize promotions.

5. Positive and negative ratios

A positive golden ratio implies that a user has more followers than friends. A negative golden ratio occurs when the user follows more people than his followers' count. It is not a negative number but is called so due to its weak influencing capacity.

6. Extract user information

Let's derive the golden ratio of users tweeting on fitness and interpret the ratio. Using search_tweets(), we extract 1000 tweets on “hashtag fitness”. Next, we use users_data() to extract the user information from the tweets.

7. Extract user information

The names() function displays the 20 column names containing user metadata.

8. Extracting followers_count and friends_count

Let's aggregate user screen names against their followers and friends counts using summarize() and group_by() from the dplyr library. The extracted user data may have multiple instances of the same user. We take the mean values of the follower and friend counts so we consider only one instance. To group data based on the screen names, group_by() takes the screen_name as input. summarize() creates one row per group and it takes the mean of followers_count and friends_count as input.

9. Extracting followers_count and friends_count

The output shows screen names with their follower and friend counts.

10. The golden ratio

Next, we calculate the golden ratio and add it as a column ratio to the grouped data frame. The ratios for the first few rows are displayed here.

11. Explore users based on the ratio

Let us examine the golden ratios to understand the user types. First, sort the data frame in decreasing order of follower values using desc() within the arrange() function.

12. Explore users based on the ratio

Then, filter users who have a follower count greater than 30000. We can see that some of these users also have a high positive ratio. These users can be used as a medium to promote products on fitness to their followers.

13. Explore users based on ratio

Next, we filter users with less than 2000 followers. We see that their golden ratio is also less than 10. A fitness brand can position adverts on these individual user accounts for targeted promotion.

14. User analysis with twitter lists

Let us now explore user analysis using twitter lists. A twitter list is a curated group of twitter accounts. Twitter users subscribe to lists that interest them.

15. Extract lists subscribed to

Let's collect twitter lists subscribed to by the account "PlayStation" using the list_users() function. We see three lists "PS Family", "GameDevelopers", and "gaming" displayed under the name column.

16. Extract subscribers to a list

Let’s extract users who have subscribed to the “gaming” list. These users are potential customers for "PlayStation" merchandise. The lists_subscribers() function takes 3 arguments: slug set to “gaming”, owner_user set to "PlayStation", and the user count set to 100.

17. View screen names of subscribers

Next, we view the screen names of users subscribed to the list.

18. User information of list subscribers

From the screen names, we select a few to know more about these users. Create a list of 4 screen names. lookup_users() takes this list as input and extracts user data for the 4 users. Based on the user information, promotional strategies can be designed for "PlayStation" merchandise.

19. Let's practice!

Did you find it interesting to analyze twitter user data? Let's practice!

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.