encodePhenotype
encodePhenotype(
df,
susceptible_label = "Susceptible",
resistant_label = "Resistant"
)A list with:
df: the input data with AMR phenotype now encoded as integer
target: a binarized vector of the encoded AMR phenotypes
df <- tibble::tibble(
genome_id = paste0("g", 1:6),
genome_drug.resistant_phenotype = c(
"Resistant", "Susceptible", "Resistant",
"Susceptible", "Resistant", "Susceptible"
),
gene_a = c(1L, 0L, 1L, 0L, 1L, 0L),
gene_b = c(0L, 1L, 1L, 0L, 0L, 1L)
)
encoded <- encodePhenotype(df)
encoded$target
#> [1] 1 0 1 0 1 0