O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Learning Social Media Analytics with R

Book Description

Tap into the realm of social media and unleash the power of analytics for data-driven insights using R

About This Book

  • A practical guide written to help leverage the power of the R eco-system to extract, process, analyze, visualize and model social media data
  • Learn about data access, retrieval, cleaning, and curation methods for data originating from various social media platforms.
  • Visualize and analyze data from social media platforms to understand and model complex relationships using various concepts and techniques such as Sentiment Analysis, Topic Modeling, Text Summarization, Recommendation Systems, Social Network Analysis, Classification, and Clustering.

Who This Book Is For

It is targeted at IT professionals, Data Scientists, Analysts, Developers, Machine Learning Enthusiasts, social media marketers and anyone with a keen interest in data, analytics, and generating insights from social data. Some background experience in R would be helpful, but not necessary, since this book is written keeping in mind, that readers can have varying levels of expertise.

What You Will Learn

  • Learn how to tap into data from diverse social media platforms using the R ecosystem
  • Use social media data to formulate and solve real-world problems
  • Analyze user social networks and communities using concepts from graph theory and network analysis
  • Learn to detect opinion and sentiment, extract themes, topics, and trends from unstructured noisy text data from diverse social media channels
  • Understand the art of representing actionable insights with effective visualizations
  • Analyze data from major social media channels such as Twitter, Facebook, Flickr, Foursquare, Github, StackExchange, and so on
  • Learn to leverage popular R packages such as ggplot2, topicmodels, caret, e1071, tm, wordcloud, twittR, Rfacebook, dplyr, reshape2, and many more

In Detail

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.

Style and approach

This book follows a step-by-step approach with detailed strategies for understanding, extracting, analyzing, visualizing, and modeling data from several major social network platforms such as Facebook, Twitter, Foursquare, Flickr, Github, and StackExchange. The chapters cover several real-world use cases and leverage data science, machine learning, network analysis, and graph theory concepts along with the R ecosystem, including popular packages such as ggplot2, caret,dplyr, topicmodels, tm, and so on.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Learning Social Media Analytics with R
    1. Table of Contents
    2. Learning Social Media Analytics with R
    3. Credits
    4. About the Author
    5. About the Reviewer
    6. www.PacktPub.com
      1. eBooks, discount offers, and more
        1. Why subscribe?
    7. Customer Feedback
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
      7. Downloading the color images of this book
        1. Errata
        2. Piracy
        3. Questions
    9. 1. Getting Started with R and Social Media Analytics
      1. Understanding social media
        1. Advantages and significance
        2. Disadvantages and pitfalls
      2. Social media analytics
        1. A typical social media analytics workflow
          1. Data access
          2. Data processing and normalization
          3. Data analysis
          4. Insights
        2. Opportunities
        3. Challenges
      3. Getting started with R
        1. Environment setup
      4. Data types
        1. Data structures
          1. Vectors
          2. Arrays
          3. Matrices
          4. Lists
          5. DataFrames
        2. Functions
          1. Built-in functions
          2. User-defined functions
        3. Controlling code flow
          1. Looping constructs
          2. Conditional constructs
        4. Advanced operations
          1. apply
          2. lapply
          3. sapply
          4. tapply
          5. mapply
        5. Visualizing data
        6. Next steps
          1. Getting help
          2. Managing packages
      5. Data analytics
        1. Analytics workflow
      6. Machine learning
        1. Machine learning techniques
        2. Supervised learning
        3. Unsupervised learning
      7. Text analytics
      8. Summary
    10. 2. Twitter – What's Happening with 140 Characters
      1. Understanding Twitter
        1. APIs
        2. Registering an application
        3. Connecting to Twitter using R
        4. Extracting sample Tweets
      2. Revisiting analytics workflow
      3. Trend analysis
      4. Sentiment analysis
        1. Key concepts of sentiment analysis
          1. Subjectivity
          2. Sentiment polarity
          3. Opinion summarization
        2. Features
        3. Sentiment analysis in R
      5. Follower graph analysis
        1. Challenges
      6. Summary
    11. 3. Analyzing Social Networks and Brand Engagements with Facebook
      1. Accessing Facebook data
        1. Understanding the Graph API
        2. Understanding Rfacebook
        3. Understanding Netvizz
        4. Data access challenges
      2. Analyzing your personal social network
        1. Basic descriptive statistics
        2. Analyzing mutual interests
        3. Build your friend network graph
        4. Visualizing your friend network graph
        5. Analyzing node properties
          1. Degree
          2. Closeness
          3. Betweenness
        6. Analyzing network communities
          1. Cliques
          2. Communities
      3. Analyzing an English football social network
        1. Basic descriptive statistics
        2. Visualizing the network
        3. Analyzing network properties
        4. Diameter
          1. Page distances
          2. Density
          3. Transitivity
          4. Coreness
        5. Analyzing node properties
          1. Degree
          2. Closeness
          3. Betweenness
          4. Visualizing correlation among centrality measures
          5. Eigenvector centrality
          6. PageRank
          7. HITS authority score
          8. Page neighbours
        6. Analyzing network communities
          1. Cliques
          2. Communities
      4. Analyzing English Football Club's brand page engagements
        1. Getting the data
        2. Curating the data
        3. Visualizing post counts per page
        4. Visualizing post counts by post type per page
        5. Visualizing average likes by post type per page
        6. Visualizing average shares by post type per page
        7. Visualizing page engagement over time
        8. Visualizing user engagement with page over time
        9. Trending posts by user likes per page
        10. Trending posts by user shares per page
        11. Top influential users on popular page posts
      5. Summary
    12. 4. Foursquare – Are You Checked in Yet?
      1. Foursquare – the app and data
        1. Foursquare APIs – show me the data
        2. Creating an application – let me in
        3. Data access – the twist in the story
        4. Handling JSON in R – the hidden art
          1. Getting category data – introduction to JSON parsing and data extraction
        5. Revisiting the analytics workflow
      2. Category trend analysis
        1. Getting the data – the usual hurdle
          1. The required end point
        2. Getting data for a city – geometry to the rescue
        3. Analysis – the fun part
          1. Basic descriptive statistics – the usual
      3. Recommendation engine – let's open a restaurant
        1. Recommendation engine – the clichés
        2. Framing the recommendation problem
        3. Building our restaurant recommender
      4. The sentimental rankings
        1. Extracting tips data – the go to step
        2. The actual data
        3. Analysis of tips
          1. Basic descriptive statistics
        4. The final rankings
      5. Venue graph – where do people go next?
      6. Challenges for Foursquare data analysis
      7. Summary
    13. 5. Analyzing Software Collaboration Trends I – Social Coding with GitHub
      1. Environment setup
      2. Understanding GitHub
      3. Accessing GitHub data
        1. Using the rgithub package for data access
        2. Registering an application on GitHub
        3. Accessing data using the GitHub API
      4. Analyzing repository activity
        1. Analyzing weekly commit frequency
        2. Analyzing commit frequency distribution versus day of the week
        3. Analyzing daily commit frequency
        4. Analyzing weekly commit frequency comparison
        5. Analyzing weekly code modification history
        6. Retrieving trending repositories
      5. Analyzing repository trends
        1. Analyzing trending repositories created over time
        2. Analyzing trending repositories updated over time
        3. Analyzing repository metrics
          1. Visualizing repository metric distributions
          2. Analyzing repository metric correlations
          3. Analyzing relationship between stargazer and repository counts
          4. Analyzing relationship between stargazer and fork counts
          5. Analyzing relationship between total forks, repository count, and health
      6. Analyzing language trends
        1. Visualizing top trending languages
        2. Visualizing top trending languages over time
        3. Analyzing languages with the most open issues
        4. Analyzing languages with the most open issues over time
        5. Analyzing languages with the most helpful repositories
        6. Analyzing languages with the highest popularity score
        7. Analyzing language correlations
        8. Analyzing user trends
        9. Visualizing top contributing users
        10. Analyzing user activity metrics
      7. Summary
    14. 6. Analyzing Software Collaboration Trends II - Answering Your Questions with StackExchange
      1. Understanding StackExchange
        1. Data access
        2. The StackExchange data dump
          1. Accessing data dumps
          2. Contents of data dumps
          3. Quick overview of the data in data dumps
            1. Posts
            2. Users
        3. Getting started with data dumps
      2. Data Science and StackExchange
      3. Demographics and data science
      4. Challenges
      5. Summary
    15. 7. Believe What You See – Flickr Data Analysis
      1. A Flickr-ing world
      2. Accessing Flickr's data
        1. Creating the Flickr app
        2. Connecting to R
        3. Getting started with Flickr data
      3. Understanding Flickr data
        1. Understanding more about EXIF
      4. Understanding interestingness – similarities
        1. Finding K
          1. Elbow method
          2. Silhouette method
      5. Are your photos interesting?
        1. Preparing the data
        2. Building the classifier
      6. Challenges
      7. Summary
    16. 8. News – The Collective Social Media!
      1. News data – news is everywhere
        1. Accessing news data
          1. Creating applications for data access
          2. Data extraction – not just an API call
          3. The API call and JSON monster
            1. HTML scraping from the links – the bigger monster
      2. Sentiment trend analysis
        1. Getting the data – not again
        2. Basic descriptive statistics – the usual
        3. Numerical sentiment trends
        4. Emotion-based sentiment trends
      3. Topic modeling
        1. Getting to the data
        2. Basic descriptive analysis
        3. Topic modeling for Mr. Trump's phases
          1. Cleaning the data
          2. Pre-processing the data
          3. The modeling part
          4. Analysis of topics
      4. Summarizing news articles
        1. Document summarization
        2. Understanding LexRank
        3. Summarizing articles with lexRankr
      5. Challenges to news data analysis
      6. Summary
    17. Index