iplotCorr: Correlation heatmap

Description Usage Arguments Details Value See Also Examples

View source: R/coin_rew8r.R

Description

Plots an interactive heatmap of a correlation matrix. Currently this only works with the aggregated data set, i.e. you need to have aggregated the data first before using this.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
iplotCorr(
  COIN,
  aglevs = NULL,
  insig = FALSE,
  levs = TRUE,
  grouprects = TRUE,
  flagcolours = TRUE,
  corthresh = NULL,
  showvals = TRUE,
  cortype = "pearson",
  useweights = NULL
)

Arguments

COIN

The COIN object

aglevs

A two length vector specifying which level to plot against which level. E.g. c(2,4) for COIN plots sub-pillars against sub-indexes. If NULL, plots everything against everything.

insig

Logical: if TRUE, all correlation values are plotted; if FALSE (default), does not plot insignificant correlations.

levs

Logical: if TRUE, plots lines showing the division between different levels. Only works if aglevs = NULL.

grouprects

Logical: if TRUE, plots rectangles showing aggregation groups.

flagcolours

If TRUE uses a discrete colour scale specified by corthresh. Otherwise uses a continuous colour map.

corthresh

A named list specifying the colour thresholds to use if flagcolours = TRUE. Entries should specify correlation thresholds and can specify any of clow, cmid and chi. Anything below clow will be coloured red. Anything between clow and cmid will be grey. Anything between cmid and chigh will be blue. Anything above chigh will be green. Default is list(clow = -0.4, cmid = 0.4, chigh = 0.85). You can specify a subset of these and the others will revert to defaults.

showvals

Logical: if TRUE, overlays correlation values on each square.

cortype

The type of correlation: either "pearson" (default), "spearman" or "kendall". See stats::cor.

useweights

An optional list of weights to use (this is used mainly in the rew8r() app).

Details

This is a slightly involved wrapper for plotly. It allows plotting any level against any other, and outputs correlation heat maps as HTML widgets. It has some flexibility regarding grouping of indicators, colouring, treatment of insignificant correlations, and the correlation type. Explore the arguments and see.

Value

A plotly correlation map (figure).

See Also

Examples

1
2
3
4
# build ASEM COIN up to aggregation
ASEM <- build_ASEM()
# correlation heatmap of pillars against sub-indexes
iplotCorr(ASEM, aglevs = c(2,3))

COINr documentation built on Nov. 30, 2021, 9:06 a.m.