annotate {matrixset}R Documentation

Create/modify/delete annotations of a matrixset object

Description

An annotation is a trait that is stored in the meta (row or column) data frame of the .ms object.

Creating an annotation is done as when applying a mutate() on a data frame. Thus, annotations can be created from already existing annotations.

The usage is the same as for dplyr::mutate(), so see this function for instructions on how to create/modify or delete traits.

The only difference is that the tag is a special annotation that can't be deleted or modify (with one exception in case of modification). The tag is the column name of the meta data frame that holds the row or column names. The tag identity of the' object can be obtained via row_tag() or column_tag(). To modify a tag, see ⁠rownames<-()⁠ or ⁠colnames<-()⁠.

Usage

annotate_row(.ms, ...)

annotate_column(.ms, ...)

Arguments

.ms

A matrixset object.

...

Name-value pairs, ala dplyr's dplyr::mutate().

Value

A matrixset with updated meta info.

See Also

annotate_row_from_apply()/annotate_column_from_apply(), a version that allows access to the matrixset matrices.

Examples

# You can create annotation from scrath or using already existing annotation
ms <- annotate_row(student_results,
                   dummy = 1,
                   passed = ifelse(previous_year_score >= 0.6, TRUE, FALSE))

# There is a direct access to matrix content with annotate_row_from_apply(),
# but here is an example on how it can be done with annotate_row()
ms <- annotate_row(student_results,
                   mn_fail = apply_matrix_dfl(student_results, mn=~ rowMeans(.m1),
                                              .matrix_wise = FALSE)$mn)


[Package matrixset version 0.3.0 Index]