biomarker_map
or model_pars
exposure and biomarker variablesR/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).
reformat_biomarker_map(input_map, exposure_key = NULL, biomarker_key = NULL)
A tibble specifying the relationship between exposure IDs and biomarker IDs
Optional vector giving the character-index relationship for exposure_id
Optional vector giving the character-index relationship for biomarker_id
input_map
is returned with unique numeric or character inputs for exposure and biomarker IDs
## 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