All About Using Python & R for Machine Learning, Data Science, Data Analyst, Deep Learning, Artificial Intelligence

Saturday, November 11, 2017

Facebook Data Collection with R

Continuing from my previous, this post will introduce to how data is collected, cleaned and analyzed
1. Collecting Data
we want to extract list of posts from a United Airline funpage with n=50

Facebook has more than a like button. Last year, it launched emoji (emoticons). If a post got 1000 likes, it does not mean everyone really loves the comment. The reaction can be happy, sad or angry. On the above code, I used "plotly" package to visualize the reaction on interactive graph. The result as belows:

postreaction ataberuntung

2. Cleaning Data
After getting comment as data, next step is creating corpus, removing extra spaces, stopwords, special characters and other unwanted things using "tm" package


3. Analyzing Data
a. Creating Term Document Matrix
A document-term matrix describes the frequency of terms that occur in a collection of documents. Rows correspond to documents in the collection and columns correspond to terms.
 Here is the 2,219 extracted words with frequency.
extract ataberuntung

b. Creating Wordcloud
wordcloud is a visual representation of text data, typically used to depict keyword metadata (tags) on websites, or to visualize free form text. The importance of each tag is shown with font size or color. To create wordcloud in R, we use "wordcloud" package.

wordcloud ataberuntung

Next post is Sentiment Analysis
Share:

0 comments:

Post a Comment

Pageviews

Visitors

Flag Counter