Book Image

Learning Social Media Analytics with R

By : Dipanjan Sarkar, Karthik Ganapathy, Raghav Bali, Tushar Sharma
Book Image

Learning Social Media Analytics with R

By: Dipanjan Sarkar, Karthik Ganapathy, Raghav Bali, Tushar Sharma

Overview of this book

The Internet has truly become humongous, especially with the rise of various forms of social media in the last decade, which give users a platform to express themselves and also communicate and collaborate with each other. This book will help the reader to understand the current social media landscape and to learn how analytics can be leveraged to derive insights from it. This data can be analyzed to gain valuable insights into the behavior and engagement of users, organizations, businesses, and brands. It will help readers frame business problems and solve them using social data. The book will also cover several practical real-world use cases on social media using R and its advanced packages to utilize data science methodologies such as sentiment analysis, topic modeling, text summarization, recommendation systems, social network analysis, classification, and clustering. This will enable readers to learn different hands-on approaches to obtain data from diverse social media sources such as Twitter and Facebook. It will also show readers how to establish detailed workflows to process, visualize, and analyze data to transform social data into actionable insights.
Table of Contents (16 chapters)
Learning Social Media Analytics with R
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
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...