This function creates a label object from metadata or an atomic vector
create.label(label, case, meta=NULL, control=NULL, p.lab = NULL, n.lab = NULL, remove.meta.column=FALSE, verbose=1)
named vector to create the label or the name of the metadata column that will be used to create the label
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).
metadata dataframe object or an object of class sample_data-class
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).
name of the positive group (useful mostly for visualizations). Default to NULL in which case the value of the positive group will be used.
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.
boolean indicating if the label column in the
metadata should be retained. Please note that if this is set to
integer, control output:
a list to be used in a SIMCAT object OR
a list with entries
remove.meta.column is set to
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
n.lab will be used as labels during plotting,
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.
data('meta_crc_zeller') label <- create.label(label='Group', case='CRC', meta=meta.crc.zeller) #> Label used as case: #> CRC #> Label used as control: #> CTR #> + finished create.label.from.metadata in 0.01 s