create.label: Create a label list

Description Usage Arguments Details Value Examples

View source: R/create_label.r

Description

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

Usage

1
2
3
4
5
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

Examples

1
2
3
data('meta_crc_zeller')

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

Example output

Loading required package: mlr
Loading required package: ParamHelpers
'mlr' is in maintenance mode since July 2019. Future development
efforts will go into its successor 'mlr3' (<https://mlr3.mlr-org.com>).
Loading required package: phyloseq
Label used as case:
   CRC
Label used as control:
   CTR
+ finished create.label.from.metadata in 0.004 s

SIAMCAT documentation built on Nov. 8, 2020, 5:14 p.m.