powered by
Converts long-form assay activity data into dense or sparse matrix-ready representations indexed by compound and assay identifiers.
pc_activity_matrix( x, cid_col = "CID", aid_col = "AID", outcome_col = "ActivityOutcome", value_map = c(Active = 1, Inactive = 0, Inconclusive = NA_real_), strict_outcome = FALSE, unknown_outcome = NA_real_, fill = NA_real_, prefix = "AID_", aggregate = c("max", "mean", "first"), output = c("tibble", "sparse") )
A wide tibble (`output = "tibble"`) or a sparse matrix wrapper object of class `PubChemSparseActivityMatrix` (`output = "sparse"`).
A long-form table or `PubChemResult` with at least CID/AID/outcome columns.
Column name containing compound identifiers.
Column name containing assay identifiers.
Column name containing activity outcome values.
Named numeric mapping for character outcomes.
Logical. If `TRUE`, unknown outcome labels raise an error.
Numeric fallback for unknown labels when `strict_outcome = FALSE`.
Fill value for missing matrix cells.
Prefix used for assay columns in wide format output.
Aggregation method for repeated CID/AID pairs.
Output type: `"tibble"` (default dense table) or `"sparse"` (Matrix backend).
Character outcomes are normalized through `pc_activity_outcome_map()`. For repeated CID/AID pairs, values are aggregated using the selected strategy.
long_tbl <- tibble::tibble( CID = c("1", "1", "2"), AID = c("10", "11", "10"), ActivityOutcome = c("Active", "Inactive", "Active") ) pc_activity_matrix(long_tbl)
Run the code above in your browser using DataLab