as_weitrix: Convert data to a weitrix

Description Usage Arguments Details Value Examples

View source: R/weitrix.R

Description

Ensure data is a weighted matrix or "weitrix". A weitrix is a SummarizedExperiment or subclass thereof with some metadata fields set. If it is ambiguous how to do this, produce an error.

Usage

1
as_weitrix(object, weights = NULL)

Arguments

object

Object to convert.

weights

Optional, weights matrix if not present in object.

Details

Input can be a matrix or DelayedArray.

Input can be anything the limma package recognizes, notably the limma EList class (for example as output by voom or vooma).

If weights are not present in "object" and not given with "weights", they default for 0 for NA values and 1 for everything else.

Value

A SummarizedExperiment object with metadata fields marking it as a weitrix.

Examples

1
2
3
4
5
6
mat <- matrix(c(1,2,NA,3,NA,4), ncol=2)
weitrix <- as_weitrix(mat)

metadata(weitrix)
weitrix_x(weitrix)
weitrix_weights(weitrix)

weitrix documentation built on Nov. 8, 2020, 8:10 p.m.