Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Social Media Analytics with R

You're reading from   Learning Social Media Analytics with R Transform data from social media platforms into actionable business insights

Arrow left icon
Product type Paperback
Published in May 2017
Publisher Packt
ISBN-13 9781787127524
Length 394 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (4):
Arrow left icon
Raghav Bali Raghav Bali
Author Profile Icon Raghav Bali
Raghav Bali
Dipanjan Sarkar Dipanjan Sarkar
Author Profile Icon Dipanjan Sarkar
Dipanjan Sarkar
Karthik Ganapathy Karthik Ganapathy
Author Profile Icon Karthik Ganapathy
Karthik Ganapathy
Tushar Sharma Tushar Sharma
Author Profile Icon Tushar Sharma
Tushar Sharma
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Getting Started with R and Social Media Analytics 2. Twitter – What's Happening with 140 Characters FREE CHAPTER 3. Analyzing Social Networks and Brand Engagements with Facebook 4. Foursquare – Are You Checked in Yet? 5. Analyzing Software Collaboration Trends I – Social Coding with GitHub 6. Analyzing Software Collaboration Trends II - Answering Your Questions with StackExchange 7. Believe What You See – Flickr Data Analysis 8. News – The Collective Social Media! Index

Demographics and data science


Social networks exist for and by its user base. StackExchange rides upon its wide user base which has a diverse set of skills. In this use case, let us try and understand the demographic related dynamics of https://datascience.stackexchange.com/.

We first begin with loading the user related data from the dumps. As discussed earlier, this information is available in the Users.XML file. We utilize the same loadXMLToDataFrame utility function to get the required DataFrame. We then get some quick details from the DataFrame such as number of users, average age, average reputation, and so on. The following snippet gets us started on the same:

# Total Users
> dim(UsersDF)
[1] 19237    14

# Average Reputation Score
> max(as.numeric(UsersDF[!is.na(UsersDF$Reputation),'Reputation']))
[1] 5305

# Average age of user on data.stack exchange
> mean(as.numeric(UsersDF[!is.na(UsersDF$Age),'Age'])) 
[1] 30.83677

Note

Readers should check data types for each of the attributes...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime