Book Image

R Data Analysis Projects

Book Image

R Data Analysis Projects

Overview of this book

R offers a large variety of packages and libraries for fast and accurate data analysis and visualization. As a result, it’s one of the most popularly used languages by data scientists and analysts, or anyone who wants to perform data analysis. This book will demonstrate how you can put to use your existing knowledge of data analysis in R to build highly efficient, end-to-end data analysis pipelines without any hassle. You’ll start by building a content-based recommendation system, followed by building a project on sentiment analysis with tweets. You’ll implement time-series modeling for anomaly detection, and understand cluster analysis of streaming data. You’ll work through projects on performing efficient market data research, building recommendation systems, and analyzing networks accurately, all provided with easy to follow codes. With the help of these real-world projects, you’ll get a better understanding of the challenges faced when building data analysis pipelines, and see how you can overcome them without compromising on the efficiency or accuracy of your systems. The book covers some popularly used R packages such as dplyr, ggplot2, RShiny, and others, and includes tips on using them effectively. By the end of this book, you’ll have a better understanding of data analysis with R, and be able to put your knowledge to practical use without any hassle.
Table of Contents (15 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Collaborative filtering


Given a user rating matrix, where several users have rated several products, the goal of collaborative filtering is as follows:

  • Predict the ratings for all products unknown to the user 
  • Produce the ratings for the top-n list of products unknown to the user

The underlying premise of the collaborative filtering algorithm is that if two users agree on ratings for a large set of items, they may tend to agree for other items too. Let us use a small R code snippet to explain this concept. Assume we have seven products (A, B, C, D, E, F, G) and two users (user.a and user.b). We also have the ratings provided by both of the users for some of the products. The ratings are range of numbers from 1 to 5, with 1 indicating a poor rating, 5 indicating a good rating, and 0 indicating no rating.

The following is an R snippet for demonstration purposes:

> set.seed(100)

> products <- c('A','B','C','D','E','F','G')
> user.a <-   c( 3,  0,  2, 5, 5, 0,1)
> user.b <-...