Description Usage Arguments Details Value See Also Examples
View source: R/coin_multivariate.R
Generates heatmaps of correlation matrices using ggplot2. 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  plotCorr(
COIN,
dset = "Raw",
icodes = NULL,
aglevs = 1,
cortype = "pearson",
withparent = "parent",
grouplev = NULL,
box_level = NULL,
showvals = TRUE,
flagcolours = FALSE,
flagthresh = c(0.4, 0.3, 0.9),
pval = 0.05,
insig_colour = "#F0F0F0",
text_colour = NULL,
discrete_colours = NULL,
box_colour = NULL,
out2 = "fig"
)

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) 
aglevs 
The aggregation levels to take the two groups of indicators from. See 
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 3length vector of thresholds for highlighting correlations, if 
pval 
The significance level for plotting correlations. Correlations with p < pval will be shown,
otherwise they will be plotted as the colour specified by 
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 4length character vector of colour codes or names to define the discrete
colour map if 
box_colour 
The line colour of grouping boxes, default black. 
out2 
If 
This function calls getCorr()
.
Note that this function can only call correlations within the same data set (i.e. only one data set in .$Data
).
If out2 = "fig"
returns a plot generated with ggplot2. These can be edited further with ggplot2 commands.
If out2 = "dflong"
returns the correlation matrix as a data frame in long form, if out2 = "dfwide"
,
returns the correlation matrix in wide form. The last option here is probably useful if you want to
present a table of the data in a report.
getCorr()
Getting correlation matrices of indicator subsets
1 2 3 4 5 6  # build ASEM COIN
ASEM < assemble(IndData = ASEMIndData, IndMeta = ASEMIndMeta, AggMeta = ASEMAggMeta)
# correlation data frame of indicators in connectivity subindex, grouped by pillar
corrs < plotCorr(ASEM, dset = "Raw", icodes = "Conn", aglevs = 1,
showvals = F, out2 = "dflong")
# NOTE to create a plot instead set out2 = "fig"

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.