Skip to contents

This function applies a custom R function to each element of the count matrix and returns the transformed matrix.

Usage

custom_matrix_transform(count_matrix, custom_expression)

Arguments

count_matrix

The count matrix to transform.

custom_expression

The custom R expression to apply to each element of the count matrix.

Value

The transformed count matrix.

Examples

# Define a count matrix
count_matrix <- matrix(1:9, nrow = 3)
# Apply the expression x + 1 to each element of the count matrix
custom_matrix_transform(count_matrix, "x + 1")
#>      [,1] [,2] [,3]
#> [1,]    2    5    8
#> [2,]    3    6    9
#> [3,]    4    7   10