plot_corr {COINr} | R Documentation |

Generates heatmaps of correlation matrices using ggplot2, which can be tailored according to the grouping and structure
of the index. This enables correlating any set of indicators against any other,
and supports calling named aggregation groups of indicators. The `withparent`

argument generates tables of correlations only with
parents of each indicator. Also supports discrete colour maps using `flagcolours`

, different types of correlation, and groups
plots by higher aggregation levels.

```
plot_corr(
coin,
dset,
iCodes = NULL,
Levels = 1,
...,
cortype = "pearson",
withparent = FALSE,
grouplev = NULL,
box_level = NULL,
showvals = TRUE,
flagcolours = FALSE,
flagthresh = NULL,
pval = 0.05,
insig_colour = "#F0F0F0",
text_colour = NULL,
discrete_colours = NULL,
box_colour = NULL,
order_as = NULL,
use_directions = FALSE
)
```

`coin` |
The coin object |

`dset` |
The target data set. |

`iCodes` |
An optional list of character vectors where the first entry specifies the indicator/aggregate codes to correlate against the second entry (also a specification of indicator/aggregate codes) |

`Levels` |
The aggregation levels to take the two groups of indicators from. See |

`...` |
Optional further arguments to pass to |

`cortype` |
The type of correlation to calculate, either |

`withparent` |
If |

`grouplev` |
The aggregation level to group correlations by if |

`box_level` |
The aggregation level to draw boxes around if |

`showvals` |
If |

`flagcolours` |
If |

`flagthresh` |
A 3-length vector of thresholds for highlighting correlations, if |

`pval` |
The significance level for plotting correlations. Correlations with |

`insig_colour` |
The colour to plot insignificant correlations. Defaults to a light grey. |

`text_colour` |
The colour of the correlation value text (default white). |

`discrete_colours` |
An optional 4-length character vector of colour codes or names to define the discrete
colour map if |

`box_colour` |
The line colour of grouping boxes, default black. |

`order_as` |
Optional list for ordering the plotting of variables. If specified, this must be a list of length 2, where each entry of the list is
a character vector of the iCodes plotted on the x and y axes of the plot. The plot will then follow the order of these character vectors. Note this must
be used with care because the |

`use_directions` |
Logical: if |

This function calls `get_corr()`

.

Note that this function can only call correlations within the same data set (i.e. only one data set in `.$Data`

).

This function uses ggplot2 to generate plots, so the plot can be further manipulated using ggplot2 commands.
See `vignette("visualisation")`

for more details on plotting.

This function replaces the now-defunct `plotCorr()`

from COINr < v1.0.

A plot object generated with ggplot2, which can be edited further with ggplot2 commands.

```
# build example coin
coin <- build_example_coin(up_to = "Normalise", quietly = TRUE)
# plot correlations between indicators in Sust group, using Normalised dset
plot_corr(coin, dset = "Normalised", iCodes = list("Sust"),
grouplev = 2, flagcolours = TRUE)
```

[Package *COINr* version 1.1.7 Index]