create.label.Rd
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
TRUE
, the function will return a list as result. Defaults to
FALSE
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
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
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.
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 s