It’s much easier to grasp complex data relationships with a graph than by scanning numbers in a spreadsheet. This introductory guide shows you how to use the R language to create a variety of useful graphs for visualizing and analyzing complex data for science, business, media, and many other fields. You’ll learn methods for highlighting important relationships and trends, reducing data to simpler forms, and emphasizing key numbers at a glance.
Anyone who wants to analyze data will find something useful here—even if you don’t have a background in mathematics, statistics, or computer programming. If you want to examine data related to your work, this book is the ideal way to start.
- Get started with R by learning basic commands
- Build single variable graphs, such as dot and pie charts, box plots, and histograms
- Explore the relationship between two quantitative variables with scatter plots, high-density plots, and other techniques
- Use scatterplot matrices, 3D plots, clustering, heat maps, and other graphs to visualize relationships among three or more variables
- Chapter 1R Basics
- Downloading the Software
- Try Some Simple Tasks
- User Interface
- Installing a Package: A GUI Interface
- Data Structures
- Sample Datasets
- The Working Directory
- Putting Data into R
- Sourcing a Script
- User-Written Functions
- A Taste of Things to Come
- Chapter 2An Overview of R Graphics
- Exporting a Graph
- Exploratory Graphs and Presentation Graphs
- Graphics Systems in R
- Chapter 1R Basics
- Getting Started with R
- Single-Variable Graphs
- Chapter 3Strip Charts
- A Simple Graph
- Data Can Be Beautiful
- Chapter 4Dot Charts
- Basic Dot Chart
- Exercise 4-1
- Chapter 5Box Plots
- The Box Plot
- Nimrod Again
- Making the Data Beautiful
- Chapter 6Stem-and-Leaf Plots
- Basic Stem-and-Leaf Plot
- Exercise 6-1
- Chapter 7Histograms
- Simple Histograms
- Histograms with a Second Variable
- Chapter 8Kernel Density Plots
- Density Estimation
- The Cumulative Distribution Function
- Chapter 9Bar Plots (Bar Charts)
- Basic Bar Plot
- Spine Plot
- Bar Spacing and Orientation
- Chapter 10Pie Charts
- Ordinary Pie Chart
- Fan Plot
- Chapter 11Rug Plots
- The Rug Plot
- Exercise 11-1
- Chapter 3Strip Charts
- Two-Variable Graphs
- Chapter 12Scatter Plots and Line Charts
- Basic Scatter Plots
- Line Charts
- Templates
- Enhanced Scatter Plots
- Chapter 13High-Density Plots
- Working with Large Datasets
- Working with Large Datasets
- Chapter 14The Bland-Altman Plot
- Assessing Measurement Reliability
- Assessing Measurement Reliability
- Chapter 15QQ Plots
- Comparing Sets of Numbers
- Comparing Sets of Numbers
- Chapter 12Scatter Plots and Line Charts
- Multivariable Graphs
- Chapter 16Scatter plot Matrices and Corrgrams
- Scatter plot Matrix
- Corrgram
- Generalized Pairs Matrix with Mixed Quantitative and Categorical Variables
- Chapter 17Three-Dimensional Plots
- 3D Scatter plots
- False Color Plots
- Bubble Plots
- Chapter 18Coplots (Conditioning Plots)
- The Coplot
- Exercise 18-1
- Chapter 19Clustering: Dendrograms and Heat Maps
- Clustering
- Heat Maps
- Chapter 20Mosaic Plots
- Graphing Categorical Data
- Graphing Categorical Data
- Chapter 16Scatter plot Matrices and Corrgrams
- What Now?
- Chapter 21Resources for Extending Your Knowledge of Things Graphical and R Fluency
- R Graphics
- General Principles of Graphics
- Learning More About R
- Statistics with R
- Appendix References
- Appendix R Colors
- Appendix The R Commander Graphical User Interface
- Appendix Packages Used/Referenced
- Appendix Importing Data from Outside of R
- Some Useful Internet Data Repositories
- Importing Data of Various Types into R
- Appendix Solutions to Chapter Exercises
- Exercises 1-1 Through 1-4
- Exercise 3-1
- Exercise 3-2
- Exercise 4-1
- Exercise 4-2
- Exercise 5-1
- Exercise 5-2
- Exercise 6-1
- Exercise 6-2
- Exercise 7-1
- Exercise 8-1
- Exercise 8-2
- Exercise 9-1
- Exercise 9-2
- Exercise 10-1
- Exercise 10-2
- Exercise 11-1
- Exercise 12-1
- Exercise 12-2
- Exercise 13-1
- Exercise 14-1
- Exercise 15-1
- Exercise 15-2
- Exercise 16-1
- Exercise 17-1
- Exercise 17-2
- Exercise 18-1
- Exercise 19-1
- Exercise 19-2
- Exercise 19-3
- Exercise 20-1
- Exercise 21-1
- Appendix Troubleshooting: Why Doesn’t My Code Work?
- Misspelling
- Confusing Uppercase/Lowercase
- Too Few (or Too Many) Parenthesis Signs
- Forgetting to Load a Package
- Forgetting to Install a Package
- A Dataset in a Loaded Package Is Not Found
- Leaving Out a Comma
- Copy-and-Paste Error
- Directory Problems—Cannot Load a Saved File
- Missing File Extension
- Do Not Assume That All Packages Use the Same Argument Abbreviations
- Outdated Packages/Package Incompatibility
- Appendix R Functions Introduced in This Book
- Data Input/Output
- Datasets
- Graphical Functions 1—Creates Graph
- Graphical Functions 2—Adds Features to Existing Graph
- Miscellaneous
- Packages
- Statistics
- User-Defined Functions and Scripts
- Workspace and Directories
- Chapter 21Resources for Extending Your Knowledge of Things Graphical and R Fluency