mapStats {CAGEr} | R Documentation

## Process mapping statistics

### Description

Using a data frame containing mapping statistics in counts, transform the data in percentages that can be used for stacked barplots.

### Usage

    mapStats(libs, scope, group = "default", facet = NULL, normalise = TRUE)

### Arguments

`libs` | A data frame with containing columns required by the `scope` chosen.
`scope` | The name of a “scope”, that defines which data is plotted and how it is normalised, or a function that implements a custom scope. See `mapStatsScopes()` for details on each scope.
`group` | A vector of factors defining groups in the data. By default, the “group” column of the “libs” table.
`facet` | A vector of factors defining facets in the data (in the sense of `ggplot2`'s facet_wrap function).
`normalise` | Whether to normalise or not. Default: `TRUE`.

### Details

See the plotAnnot vignette and the `mapStatsScopes()` help page for details on what the scopes are.

See http://stackoverflow.com/questions/10417003/stacked-barplot-with-errorbars-using-ggplot2 about stacked barplot.

### Value

Returns a data frame with mean and standard deviation of normalised mapping statistics, plus absolute positions for the error bars. The first column, `group`, is a vector of factors sorted with the `gtools::mixedorder()` function. The facet column, if any, is always called `facet`.

### Author(s)

Charles Plessy

### See Also

plotAnnot, mapStatsScopes

### Examples

    library(SummarizedExperiment)
    CAGEr:::mapStats(as.data.frame(colData(exampleCAGEexp)), "counts", sampleLabels(exampleCAGEexp))
    CAGEr:::mapStats(as.data.frame(colData(exampleCAGEexp)), "counts", c("A", "A", "B", "B", "C"))

[Package CAGEr version 2.0.2 Index]