as_matrix_except_first_column: convert a wide-format data.frame to a matrix

View source: R/util_generic.R

as_matrix_except_first_columnR Documentation

convert a wide-format data.frame to a matrix

Description

after pivoting a long-format tibble to wide-format, use this function to easily convert to a matrix (e.g. for efficient numerical computation using the matrixStats package)

Usage

as_matrix_except_first_column(x)

Arguments

x

a wide-format data.frame or tibble where the first column are assumed to represent unique row identifiers and other columns assumed 'data' columns for the output matrix

Examples

## Not run: 
  m = as_matrix_except_first_column(dataset$peptides %>%
    pivot_wider(id_cols = "peptide_id", names_from = "sample_id", values_from = "intensity")
  )

## End(Not run)


ftwkoopmans/msdap documentation built on March 5, 2025, 12:15 a.m.