Book Image

R Data Analysis Cookbook - Second Edition

By : Kuntal Ganguly, Shanthi Viswanathan, Viswa Viswanathan
Book Image

R Data Analysis Cookbook - Second Edition

By: Kuntal Ganguly, Shanthi Viswanathan, Viswa Viswanathan

Overview of this book

Data analytics with R has emerged as a very important focus for organizations of all kinds. R enables even those with only an intuitive grasp of the underlying concepts, without a deep mathematical background, to unleash powerful and detailed examinations of their data. This book will show you how you can put your data analysis skills in R to practical use, with recipes catering to the basic as well as advanced data analysis tasks. Right from acquiring your data and preparing it for analysis to the more complex data analysis techniques, the book will show you how you can implement each technique in the best possible manner. You will also visualize your data using the popular R packages like ggplot2 and gain hidden insights from it. Starting with implementing the basic data analysis concepts like handling your data to creating basic plots, you will master the more advanced data analysis techniques like performing cluster analysis, and generating effective analysis reports and visualizations. Throughout the book, you will get to know the common problems and obstacles you might encounter while implementing each of the data analysis techniques in R, with ways to overcoming them in the easiest possible way. By the end of this book, you will have all the knowledge you need to become an expert in data analysis with R, and put your skills to test in real-world scenarios.
Table of Contents (14 chapters)

A practical example - fraud detection system

Machine learning algorithms tend to tremble when faced with imbalanced classification datasets due to the lack of necessary information about the minority class to make an accurate prediction. Imbalanced classification refers to a supervised learning problem where one class outnumbers another class by a large proportion.

Luckily, there are some useful techniques to treat imbalanced datasets before applying the dataset for ML prediction:

  • Undersampling: This approach reduces the number of observations from the majority class to make the dataset balanced and is well suited for large datasets by eliminating some training examples of the majority class.
  • Oversampling: This approach randomly replicates the observations from the minority class to balance the data. It is also known as Upsampling.
  • Synthetic Minority Oversampling (SMOTE): This...