long_to_matrix {proBatch} | R Documentation

## Long to wide data format conversion

### Description

Convert from a long data frame representation to a wide matrix representation

### Usage

    long_to_matrix(
      df_long,
      feature_id_col = "peptide_group_label",
      measure_col = "Intensity",
      sample_id_col = "FullRunName",
      qual_col = NULL,
      qual_value = 2
    )

### Arguments

`df_long` | data frame where each row is a single feature in a single sample. It minimally has a `sample_id_col`, a `feature_id_col` and a `measure_col`, but usually also an `m_score` (in OpenSWATH output result file). See `help("example_proteome")` for more details.
`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).
`qual_col` | column to color point by certain value denoted by `color_by_qual_value`. Design with inferred/requant values in OpenSWATH output data, which means argument value has to be set to `m_score`.
`qual_value` | value in `qual_col` to color. For OpenSWATH data, this argument value has to be set to `2` (this is an `m_score` value for imputed values (requant values).

### Value

`data_matrix` (proBatch) like matrix (features in rows, samples in columns)

### See Also

Other matrix manipulation functions: `matrix_to_long()`

### Examples

    proteome_matrix <- long_to_matrix(example_proteome)

[Package proBatch version 1.10.0 Index]