Learn R Programming

balance (version 0.2.4)

balance.plot: Calculate and Visualize Balances

Description

This function calculates balances based on the compositional data set and serial binary partition (SBP) matrix provided, then generates a figure from the results.

Usage

balance.plot(x, y, d.group, n.group, boxplot.split = TRUE,
  weigh.var = FALSE, size.text = 20, size.pt = 4)

Arguments

x

A matrix with rows as samples (N) and columns as components (D).

y

A serial binary partition matrix with rows as components (D) and columns as balances (D-1).

d.group

A vector of group labels for components. Optional. If provided, used to color component points.

n.group

A vector of group labels for samples. Optional. If provided, used to color sample points.

boxplot.split

A boolean. Toggles whether to split the boxplot by n.group. TRUE better resembles balance dendrogram style.

weigh.var

A boolean. Toggles whether to weigh line width by the proportion of explained variance. Only do this if balances come from an SBP that decomposes variance.

size.text

An integer. Sets legend text size.

size.pt

An integer. Sets point size.

Value

A list of the "partition" ggplot object, the "distribution" ggplot object, and the per-sample balances.

Examples

Run this code
# NOT RUN {
library(balance)
data(iris)
x <- iris[,1:4]
sbp <- sbp.fromPBA(x)
balance(x, sbp)

# }

Run the code above in your browser using DataLab