Skip to contents

This function simulates a matrix where each column corresponds to a signature, and each entry in the matrix is a random proportion of a set of channels. The proportions in each column sum to 1.

Usage

simulate_signature_matrix(signatures, channels, digits = 2, seed = NULL)

Arguments

signatures

A vector of signature names to be used as column names in the resulting matrix.

channels

A vector of channel names to be used as row names in the resulting matrix.

digits

Integer value indicating the number of decimal places to which the proportions should be rounded. Default is 2.

seed

An optional seed value for reproducibility. Default is NULL, meaning no seed is set.

Value

A matrix where rows represent channels and columns represent signatures. Each entry is a randomly generated proportion, and the values in each column sum to 1.

Examples

signatures <- c("Signature1", "Signature2", "Signature3")
channels <- c("Channel1", "Channel2", "Channel3")
simulate_signature_matrix(signatures, channels, digits = 2, seed = 123)
#>          Signature1 Signature2 Signature3
#> Channel1       0.19       0.47       0.27
#> Channel2       0.53       0.50       0.45
#> Channel3       0.28       0.02       0.28