matrix_to_long {proBatch} | R Documentation

## Wide to long conversion

### Description

Convert from wide matrix to a long data frame representation

### Usage

    matrix_to_long(
      data_matrix,
      sample_annotation = NULL,
      feature_id_col = "peptide_group_label",
      measure_col = "Intensity",
      sample_id_col = "FullRunName",
      step = NULL
    )

### Arguments

`data_matrix` | features (in rows) vs samples (in columns) matrix, with feature IDs in rownames and file/sample names as colnames. See "example_proteome_matrix" for more details (to call the description, use `help("example_proteome_matrix")`)
`sample_annotation` | data frame with: `sample_id_col` (this can be repeated as row names) biological covariates technical covariates (batches etc) . See `help("example_sample_annotation")`
`feature_id_col` | name of the column with feature/gene/peptide/protein ID used in the long format representation `df_long`. In the wide formatted representation `data_matrix` this corresponds to the row names.
`measure_col` | if `df_long` is among the parameters, it is the column with expression/abundance/intensity; otherwise, it is used internally for consistency.
`sample_id_col` | name of the column in `sample_annotation` table, where the filenames (colnames of the `data_matrix` are found).
`step` | normalization step (e.g. `Raw` or `Normalized`. Useful if consecutive steps are compared in plots. Note that in plots these are usually ordered alphabetically, so it's worth naming with numbers, e.g. `1_raw`, `2_quantile`

### Value

`df_long` (proBatch) like data frame

### See Also

Other matrix manipulation functions: `long_to_matrix()`

### Examples

    proteome_long <- matrix_to_long(example_proteome_matrix,
    example_sample_annotation)

[Package proBatch version 1.6.0 Index]