#### Overview of this book

Hands-On Exploratory Data Analysis with R will help you build a strong foundation in data analysis and get well-versed with elementary ways to analyze data. You will learn how to understand your data and summarize its characteristics. You'll also study the structure of your data, and you'll explore graphical and numerical techniques using the R language. This book covers the entire exploratory data analysis (EDA) process—data collection, generating statistics, distribution, and invalidating the hypothesis. As you progress through the book, you will set up a data analysis environment with tools such as ggplot2, knitr, and R Markdown, using DOE Scatter Plot and SML2010 for multifactor, optimization, and regression data problems. By the end of this book, you will be able to successfully carry out a preliminary investigation on any dataset, uncover hidden insights, and present your results in a business context.
Preface
Free Chapter
Section 1: Setting Up Data Analysis Environment
Setting Up Our Data Analysis Environment
Examining, Cleaning, and Filtering
Visualizing Data Graphically with ggplot2
Creating Aesthetically Pleasing Reports with knitr and R Markdown
Section 2: Univariate, Time Series, and Multivariate Data
Univariate and Control Datasets
Time Series Datasets
Multivariate Datasets
Section 3: Multifactor, Optimization, and Regression Data Problems
Multi-Factor Datasets
Handling Optimization and Regression Data Problems
Section 4: Conclusions
Next Steps
Other Books You May Enjoy

# Visualizing Data Graphically with ggplot2

This chapter will demonstrate how to draw different kinds of plots and charts, such as scatter plots, histograms, probability plots, residual plots, box plots, and block plots. We will cover various concepts throughout this chapter, including when we should use different kinds of plots. The code examples in this chapter will utilize the popular R package – ggplot2. We will introduce ggplot2 visualization grammar and learn how to apply it to real-world datasets. We will also demonstrate the examples in this chapter using the iris dataset.

The following topics will be covered in this chapter:

• Advanced graphics grammar of ggplot2 for data visualization
• Drawing and customizing scatter plots
• When to use histogram plots and how to draw and customize them
• Visualizing probability plots
• Drawing and customizing residual plots
• Making box...