Book contents
- Frontmatter
- Contents
- List of Figures
- List of Tables
- List of Boxes
- Acknowledgments
- 1 Introduction
- PART I R AND BASIC STATISTICS
- 2 Introduction to R
- 3 Looking at Data – Numerical Summaries
- 4 Looking at Data – Tables
- 5 Looking at Data – Graphs
- 6 Transformations
- 7 Missing Values
- 8 Confidence Intervals and Hypothesis Testing
- 9 Relating Variables
- PART II MULTIVARIATE METHODS
- PART III ARCHAEOLOGICAL APPROACHES TO DATA
- References
- Index
5 - Looking at Data – Graphs
from PART I - R AND BASIC STATISTICS
Published online by Cambridge University Press: 22 July 2017
- Frontmatter
- Contents
- List of Figures
- List of Tables
- List of Boxes
- Acknowledgments
- 1 Introduction
- PART I R AND BASIC STATISTICS
- 2 Introduction to R
- 3 Looking at Data – Numerical Summaries
- 4 Looking at Data – Tables
- 5 Looking at Data – Graphs
- 6 Transformations
- 7 Missing Values
- 8 Confidence Intervals and Hypothesis Testing
- 9 Relating Variables
- PART II MULTIVARIATE METHODS
- PART III ARCHAEOLOGICAL APPROACHES TO DATA
- References
- Index
Summary
Tables of counts and statistical summaries are quick and compact ways to begin exploring a new data set, but they are limited. To really visualize data distributions and the relationships among variables, we need charts and graphs. R has extensive graphic capabilities including the standard pie charts, bar charts, histograms, box-and-whisker plots, and scatter plots. Newer methods such as dot plots, kernel density plots, violin plots, and ways of representing three or more variables simultaneously are also available.
R has several graphics systems. One is the base graphics system that is included in R. With this system, graphs and charts are created using functions that write directly to a graphics output device that can be a window on your computer screen or a file. Graphs can be built up using multiple functions that can be stored as R script files, allowing you to regenerate the graph whenever needed (Murrell, 2011). A second graphics system focuses on interactive graphs and 3D graphs using the rgl package. We will use rgl to create an interactive 3-D plot. A third system, lattice, sets up the graph as a grid object (just like data frames or tables are created as objects) and then that object is printed to a graphics device (Sarkar, 2008). Lattice rolls all of the steps you would use with base graphics into a single function call. It is more difficult to learn, but it provides a very easy way to make multiple graphs showing different samples or subgroups of the data set all at once. Finally, a relatively new system that tries to combine the best of base and lattice graphics with a consistent command structure is ggplot2 (Wickham, 2009). We will not try to cover lattice or ggplot2. One of the advantages of R is the large community of people using R and adding new functions. Graphics is a perfect example of this productivity.
There are a number of sources available that describe how to produce graphs and charts that are clear, informative, and easy to interpret. They range from graphs that can be produced simply using a pencil and paper (Tukey, 1977) to graphs that communicate information clearly based on experiments on human perception to see what kinds of depictions are correctly interpreted (Cleveland, 1993, 1994) to graphs that retain an aesthetic quality while communicating effectively (Tufte, 1983, 1990).
- Type
- Chapter
- Information
- Quantitative Methods in Archaeology Using R , pp. 85 - 125Publisher: Cambridge University PressPrint publication year: 2017