Skip to content

Commit

Permalink
[r] removed unused variable
Browse files Browse the repository at this point in the history
  • Loading branch information
immanuelazn committed Dec 14, 2024
1 parent 2f83ae6 commit 6381f74
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions r/R/transforms.R
Original file line number Diff line number Diff line change
Expand Up @@ -936,10 +936,9 @@ regress_out <- function(mat, latent_data, prediction_axis = c("row", "col")) {
#' the log normalization of that element, \eqn{\tilde{x}_{ij}} is calculated as:
#' \eqn{\tilde{x}_{ij} = \log(\frac{x_{ij} \cdot \text{scaleFactor}}{\text{colSum}_j} + 1)}
#' @export
normalize_log <- function(mat, scale_factor = 1e4, add_one = TRUE, threads = 1L) {
normalize_log <- function(mat, scale_factor = 1e4, threads = 1L) {
assert_is(mat, "IterableMatrix")
assert_is_numeric(scale_factor)
assert_true(is.logical(add_one))
assert_greater_than_zero(scale_factor)
read_depth <- matrix_stats(mat, col_stats = c("mean"), threads = threads)$col_stats["mean", ] * nrow(mat)
mat <- mat %>% multiply_cols(1 / read_depth)
Expand Down
2 changes: 1 addition & 1 deletion r/man/normalize_log.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion r/tests/testthat/test-matrix_transforms.R
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ test_that("tf-idf normalization works", {


res <- normalize_tfidf(m2)
expect_equal(res %>% as("dgCMatrix"), res_dgc)
expect_equal(res %>% as("dgCMatrix"), res_dgc, tolerance = 1e-6)
res_with_row_means <- normalize_tfidf(m2, feature_means = row_means)
expect_identical(res, res_with_row_means)

Expand Down

0 comments on commit 6381f74

Please sign in to comment.