Learn R Programming

PubChemR (version 3.0.0)

pc_activity_outcome_map: Harmonize Activity Outcome Labels

Description

Converts textual activity outcomes (for example, `Active`/`Inactive`) into numeric values for matrix and modeling workflows.

Maps textual activity outcomes (for example, `Active`/`Inactive`) to numeric values for modeling workflows.

Usage

pc_activity_outcome_map(values, map = NULL, strict = FALSE, unknown = NA_real_)

Value

Numeric vector aligned with `values`.

Arguments

values

Outcome values (character/factor/numeric).

map

Optional named numeric map. Names are matched case-insensitively after trimming.

strict

Logical. If `TRUE`, unknown non-empty labels raise an error.

unknown

Numeric value assigned to unknown labels when `strict = FALSE`.

Details

Matching is case-insensitive after trimming whitespace. Custom maps augment the built-in defaults unless names overlap.

Examples

Run this code
pc_activity_outcome_map(c("Active", "Inactive", "Unknown"))

Run the code above in your browser using DataLab