mosaic {MatrixQCvis} | R Documentation

## Mosaic plot for two factors in colData(se)

### Description

The function 'mosaic' creates a mosaic plot of two factors from an 'SummararizedExperiment' object. The columns 'f1' and 'f2' are taken from 'colData(se)'.

### Usage

    mosaic(se, f1, f2)

### Arguments

`se` | 'SummarizedExperiment' object
`f1` | 'character', 'f1' is one of the column names in 'colData(se)'
`f2` | 'character', 'f2' is one of the column names in 'colData(se)'

### Details

Code partly taken from https://stackoverflow.com/questions/21588096/pass-string-to-facet-grid-ggplot2

### Value

'gg' object from 'ggplot2'

### Examples

    ## create se
    set.seed(1)
    a <- matrix(rnorm(100), nrow = 10, ncol = 10,
                dimnames = list(1:10, paste("sample", 1:10)))
    a[c(1, 5, 8), 1:5] <- NA
    cD <- data.frame(name = colnames(a),
        type = c(rep("1", 5), rep("2", 5)),
        cell_type = c("A", "B"))
    rD <- data.frame(spectra = rownames(a))
    se <- SummarizedExperiment::SummarizedExperiment(assay = a,
        rowData = rD, colData = cD)

    mosaic(se, "cell_type", "type")

[Package MatrixQCvis version 1.2.4 Index]