hoeffDPlot: Create a plot from a list of Hoeffding's D values

View source: R/tab_values.R

hoeffDPlotR Documentation

Create a plot from a list of Hoeffding's D values

Description

The function hoeffDPlot creates via ggplot a violin plot per factor, a jitter plot of the data points and (optionally) connects the points via lines. hoeffDPlot uses the plotly package to make the figure interactive.

Usage

hoeffDPlot(df, lines = TRUE)

Arguments

df

data.frame containing one or multiple columns containing the Hoeffding's D statistics

lines

logical, should points belonging to the same sample be connected

Details

The function hoeffDPlot will create the violin plot and jitter plot according to the specified order given by the colnames of df. hoeffDPlot will thus internally refactor the colnames of the supplied data.frame according to the order of the colnames.

Value

gg object from ggplot2

Examples

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

tbl <- MAvalues(se, log = FALSE, group = "all")
hd_r <- hoeffDValues(tbl, "raw")

## normalized values
se_n <- se
assay(se_n) <- normalizeAssay(a, "sum")
tbl_n <- MAvalues(se_n, log = FALSE, group = "all")
hd_n <- hoeffDValues(tbl_n, "normalized")

df <- data.frame(raw = hd_r, normalized = hd_n)
hoeffDPlot(df, lines = TRUE)
hoeffDPlot(df, lines = FALSE)


tnaake/MatrixQCvis documentation built on June 20, 2024, 7:22 a.m.