create.label {SIAMCAT} | R Documentation

## Create a label list

### Description

This function creates a label object from metadata or an atomic vector

### Usage

    create.label(label, case,
        meta=NULL, control=NULL,
        p.lab = NULL, n.lab = NULL,
        remove.meta.column=FALSE,
        verbose=1)

### Arguments

`label` | named vector to create the label or the name of the metadata column that will be used to create the label
`case` | name of the group that will be used as a positive label. If the variable is binary, the other label will be used as a negative one. If the variable has multiple values, all the other values will be used a negative label (testing one vs rest).
`meta` | metadata dataframe object or an object of class sample_data-class
`control` | name of a label or vector with names that will be used as a negative label. All values that are nor equal to case and control will be dropped. Default to NULL in which case: If the variable is binary, the value not equal to case will be used as negative. If the variable has multiple values, all the values not equal to cases will be used a negative label (testing one vs rest).
`p.lab` | name of the positive group (useful mostly for visualizations). Default to NULL in which case the value of the positive group will be used.
`n.lab` | name of the negative group (useful mostly for visualizations). Default to NULL in which case the value of the negative group will be used for binary variables and "rest" will be used for variables with multiple values.
`remove.meta.column` | boolean indicating if the label column in the metadata should be retained. Please note that if this is set to `TRUE`, the function will return a list as result. Defaults to `FALSE`
`verbose` | integer, control output: `0` for no output at all, `1` for only information about progress and success, `2` for normal level of information and `3` for full debug information, defaults to `1`

### Details

The function creates a list to be used as label in a SIAMCAT object. Mainly for interal use, but it can be used to customize your label (`p.lab` and `n.lab` will be used as labels during plotting, for example).

The input for the function can be either a named vector encoding the label or the name of a column in the metadata (needs to be provided as well) which contains the label information.

### Value

return either

- a list to be used in a SIMCAT object OR

- a list with entries `meta` and `label`, if `remove.meta.column` is set to `TRUE`

### Examples

    data('meta_crc_zeller')

    label <- create.label(label='Group', case='CRC', meta=meta.crc.zeller)

[Package SIAMCAT version 1.14.0 Index]