read.labels {SIAMCAT} | R Documentation

## Read labels file

### Description

This file reads in the tsv file with labels and converts it into a label object.

First row is expected to be `#BINARY:1=[label for cases]; -1=[label for controls]`. Second row should contain the sample identifiers as tab-separated list (consistent with feature and metadata).

Third row is expected to contain the actual class labels (tab-separated): `1` for each case and `-1` for each control.

Note: Labels can take other numeric values (but not characters or strings); importantly, the label for cases has to be greater than the one for controls

### Usage

    read.labels(fn.in.label)

### Arguments

`fn.in.label` | name of the tsv file containing labels

### Value

label object containing several entries:

- `$label` named vector containing the numerical labels from the file;

- `$header` first row of the label file;

- `$info` information about the type of label (e.g. `BINARY`);

- `$positive.lab` numerical label for controls, e.g. `-1`;

- `$negative.lab` numerical label for cases, e.g. `1`;

- `$n.idx` logical vector of labels (`TRUE` for controls, `FALSE` otherwise);

- `$n.lab` label for controls, e.g. `healthy`;

- `$p.idx` logical vector of labels (`TRUE` for cases, `FALSE` otherwise);

- `$p.lab` label for cases, e.g. `cancer`

### Examples

        # run with example data
    fn.label <- system.file('extdata',
    'label_crc_study-pop-I_N141_tax_profile_mocat_bn_specI_clusters.tsv',
        package = 'SIAMCAT')

    labels <- read.labels(fn.label)

[Package SIAMCAT version 1.0.0 Index]