Skip to contents

Pivots input to a wide row × col matrix of (mean, if needed) Log2Area values, dropping rows that are entirely NA ("phantom IDs") and ordering columns by the factor levels of col.

Usage

get_mat_log2area(input, row, col)

Arguments

input

A pep_all-shaped data frame with Log2Area and the columns named by row/col.

row

Column to use for matrix rows (tidy-evaluated; usually PeptideID or ProteinFirst).

col

Column to use for matrix columns (tidy-evaluated; must be a factor — its levels set the column order, e.g. Sample or Condition). When several rows share the same col value, their Log2Area values are averaged (na.rm = TRUE).

Value

A numeric matrix with NAs preserved, rows named by row and columns ordered by the factor levels of col. When no row has a single non-missing Log2Area (all Areas absent or zero), a 0 x n matrix with the expected column names is returned with a warning.

Examples

if (FALSE) { # \dontrun{
get_mat_log2area(pep_all, PeptideID, Sample)
} # }