Learn R Programming

COINr (version 1.1.14)

plot_dist: Static indicator distribution plots

Description

Plots indicator distributions using box plots, dot plots, violin plots, violin-dot plots, and histograms. Supports plotting multiple indicators by calling aggregation groups.

Usage

plot_dist(
  coin,
  dset,
  iCodes,
  ...,
  type = "Box",
  normalise = FALSE,
  global_specs = NULL
)

Value

A ggplot2 plot object.

Arguments

coin

The coin object, or a data frame of indicator data

dset

The name of the data set to apply the function to, which should be accessible in .$Data.

iCodes

Indicator code(s) to plot. See details.

...

Further arguments passed to get_data() (other than coin, dset and iCodes).

type

The type of plot. Currently supported "Box", "Dot", "Violin", "Violindot", "Histogram".

normalise

Logical: if TRUE, normalises the data first, using global_specs. If FALSE (default), data is not normalised.

global_specs

Specifications for normalising data if normalise = TRUE. This is passed to the global_specs argument of Normalise().

Details

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 plotIndDist() from COINr < v1.0.

Examples

Run this code
# build example coin
coin <- build_example_coin(up_to = "new_coin")

# plot all indicators in P2P group
plot_dist(coin, dset = "Raw", iCodes = "P2P", Level = 1, type = "Violindot")

Run the code above in your browser using DataLab