Book Image

R Data Science Essentials

Book Image

R Data Science Essentials

Overview of this book

With organizations increasingly embedding data science across their enterprise and with management becoming more data-driven it is an urgent requirement for analysts and managers to understand the key concept of data science. The data science concepts discussed in this book will help you make key decisions and solve the complex problems you will inevitably face in this new world. R Data Science Essentials will introduce you to various important concepts in the field of data science using R. We start by reading data from multiple sources, then move on to processing the data, extracting hidden patterns, building predictive and forecasting models, building a recommendation engine, and communicating to the user through stunning visualizations and dashboards. By the end of this book, you will have an understanding of some very important techniques in data science, be able to implement them using R, understand and interpret the outcomes, and know how they helps businesses make a decision.
Table of Contents (15 chapters)
R Data Science Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Dataset and transformation


In this chapter, we will use the dataset that was used in the Chapter 3, Pattern Discovery. This dataset has two columns, namely the userID and items. We will consider that the UserID column represents the users and the Items column represents the products purchased by the user.

Let's have a look at the dataset by reading the dataset to the R environment:

# reading the dataset
rdata <- read.csv("Data/following.csv")
head(rdata, 10)

The output of the preceding code is as follows:

Now, based on the purchase history of all the users, we need to recommend the products that the user might be interested in buying. This can be done by first identifying the similar users and then extracting the new products from the most similar users. We will get into the details of this approach in this chapter.

First of all, in order to build a recommendation system, we need to alter the dataset to a matrix in such a fashion that the items become the row names and the user ID will become...