Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Social Media Mining with R

You're reading from   Mastering Social Media Mining with R Extract valuable data from your social media sites and make better business decisions using R

Arrow left icon
Product type Paperback
Published in Sep 2015
Publisher
ISBN-13 9781784396312
Length 248 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Toc

Table of Contents (8) Chapters Close

Preface 1. Fundamentals of Mining 2. Mining Opinions, Exploring Trends, and More with Twitter FREE CHAPTER 3. Find Friends on Facebook 4. Finding Popular Photos on Instagram 5. Let's Build Software with GitHub 6. More Social Media Websites Index

Accessing product reviews from sites


Online product reviews are a very good source of information. They can be used to judge a brand or a product. It becomes very difficult to read all the reviews, so we can write a program to get the product reviews. Let's see one of the ways to extract the customer review data from Amazon. For example, let's consider the movie Transformers – Age of Extinction and see the customer reviews:

urll<- 'http://www.amazon.com/gp/video/detail/B00L83TQR6?ie=UTF8&redirect=true&ref_=s9_nwrsa_gw_g318_i1'

First, we get the relevant URL and store it in a variable so that it can be used in the functions. Then, we need to parse the HTML content of the page and save it to the variable doc. In order to do so, we need to import the package XML. Now, the parsed HTML is stored in the variable doc. Please follow the link for more details on the HTML DOM: http://www.w3schools.com/jsref/dom_obj_document.asp. The code is as follows:

library(XML)
doc<- htmlParse(urll...
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
Banner background image