Finally, we introduce another function from the GGaly library. Ggpair. It produces a graph in a matrix format. We can display three kinds of computation within one graph. The matrix is a dimension, with equals the number of observations. The upper/lower part displays windows and in the diagonal. We can control what information we want to show in each part of the matrix. The formula for ggpair is:
ggpair(df, columns = 1: ncol(df), title = NULL,
upper = list(continuous = "cor"),
lower = list(continuous = "smooth"),
mapping = NULL)
Arguments:
- df: Dataset used
- columns: Select the columns to draw the plot
- title: Include a title
- upper: Control the boxes above the diagonal of the plot. Need to supply the type of computations or graph to return. If continuous = "cor", we ask R to compute the correlation. Note that, the argument needs to be a list. Other arguments can be used, see the [vignette]("http://ggobi.github.io/ggally/#custom_functions") for more information.
- Lower: Control the boxes below the diagonal.
- Mapping: Indicates the aesthetic of the graph. For instance, we can compute the graph for different groups.