hist_sample {MatrixQCvis} | R Documentation

## Plot a histogram of the number of a category

### Description

'hist_sample' plots the number of a category (e.g. sample types) as a histogram. It use the returned 'tbl' from 'hist_sample_num'.

### Usage

    hist_sample(tbl, category = "type")

### Arguments

`tbl` | 'tbl' as returned by 'hist_sample_num'
`category` | 'character', x-axis label of the plot

### Value

'gg' object from 'ggplot2'

### Examples

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

    tbl <- hist_sample_num(se, category = "type")
    hist_sample(tbl)

[Package MatrixQCvis version 1.0.0 Index]