R: Plot assignment distributions

plotAssignments {swfscMisc} | R Documentation

## Plot assignment distributions

### Description

Plot individual assignment probability distributions.

### Usage

    plotAssignments(probs, orig, type = NULL, ylab = NULL, plot = TRUE)

### Arguments

`probs` | matrix or data.frame of individual assignment probabilities. Each column represents probability of assignment to that group and rows sum to one.
`orig` | vector of original group assignments
`type` | either `area` for stacked continuous area plot or `bar` for discrete stacked bar chart. The latter is prefered for small numbers of cases. If not specified, a bar chart will be used if all classes have <= 30 cases.
`ylab` | label for y-axis
`plot` | display the plot?

### Value

the `ggplot` object is invisibly returned.

### Author(s)

Eric Archer eric.archer@noaa.gov

### Examples

    n <- 40
    probs <- abs(c(rnorm(n, 80, 10), rnorm(n, 20, 10)))
    probs <- (probs - min(probs)) / max(probs)
    probs <- cbind(probs, 1 - probs)
    colnames(probs) <- NULL
    orig <- rep(c("Group.1", "Group.2"), each = n)

    plotAssignments(probs, orig)

    n <- 15
    probs <- abs(c(rnorm(n, 80, 10), rnorm(n, 20, 10)))
    probs <- (probs - min(probs)) / max(probs)
    probs <- cbind(probs, 1 - probs)
    colnames(probs) <- NULL
    orig <- rep(c("Group.1", "Group.2"), each = n)

    plotAssignments(probs, orig)

[Package swfscMisc version 1.2 Index]