Transforms raw counts expression data into log1p(CPM) (Counts Per Million). This is a common normalization method for gene expression data that accounts for library size differences and applies a log transformation to reduce the effect of outliers.
log_cpm(expression)
A data.frame containing log1p(CPM) transformed data.
# Create a sample expression matrix with raw counts
raw_counts <- data.frame(
gene1 = c(100, 200, 300),
gene2 = c(50, 100, 150),
gene3 = c(10, 20, 30)
)
# Transform to log CPM
log_cpm_data <- log_cpm(raw_counts)
print(log_cpm_data)
#> gene1 gene2 gene3
#> 1 13.34551 11.95922 9.944358
#> 2 14.03865 12.65236 10.637481
#> 3 14.44412 13.05783 11.042938