Skip to contents

If some samples are missing from the matrix, add them with filled in 0 as value and normalize their ordering for consistency.

Usage

complete_missing_from_matrix(
  incoming_matrix,
  list_of_samples,
  fill_in_values = 0,
  normalize_order = TRUE,
  samples_in_rows = TRUE
)

Arguments

incoming_matrix

A matrix or data frame that should be filled. Required parameter.

list_of_samples

Vector specifying all desired samples to be present in the resulting matrix. Required parameter.

fill_in_values

Value that will be used to fill in the matrix.

normalize_order

Logical parameter specifying whether sample order should be according to the supplied list. Default is TRUE.

samples_in_rows

Logical argument indicating whether samples are in rows or columns. Default assumes samples are in rows and columns are features.

Value

A data frame with maintained orientation (rows and columns) where samples from the supplied list are present and reordered according to the specified order.

Examples

if (FALSE) { # \dontrun{
partial_matrix = get_coding_ssm_status(these_samples_metadata = (get_gambl_metadata(case_set = "BL--DLBCL") %>% filter(pairing_status == "unmatched")), include_hotspots = FALSE)
complete_matrix = complete_missing_from_matrix(partial_matrix, get_gambl_metadata() %>% pull(sample_id))
} # }