
Reformat biomarker_map
or model_pars
exposure and biomarker variables
Source: R/misc_functions.R
reformat_biomarker_map.Rd
This function will reformat the biomarker_map
or model_pars
objects so that exposure_ID and biomarker_ID are either both numeric (if passed as characters) or characters (if passed as numeric).
Arguments
- input_map
A tibble specifying the relationship between exposure IDs and biomarker IDs
- exposure_key
Optional vector giving the character-index relationship for
exposure_id
- biomarker_key
Optional vector giving the character-index relationship for
biomarker_id
Examples
## Convert characters to numeric
biomarker_map <- dplyr::tibble(exposure_id=c("infection","vaccination"),biomarker_id=c("IgG","IgG"))
reformat_biomarker_map(biomarker_map)
#> # A tibble: 2 × 2
#> exposure_id biomarker_id
#> <dbl> <dbl>
#> 1 1 1
#> 2 2 1
## Convert numeric to characters
biomarker_map <- dplyr::tibble(exposure_id=c(1,2),biomarker_id=c(1,1))
reformat_biomarker_map(biomarker_map, exposure_key=c("infection","vaccination"),biomarker_key=c(1))
#> # A tibble: 2 × 2
#> exposure_id biomarker_id
#> <chr> <dbl>
#> 1 infection 1
#> 2 vaccination 1