Skip to content

Commit

Permalink
Do not create matrix of NA when a numeric matrix is needed, use NA_real_
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristophH committed Apr 1, 2019
1 parent 95cdaad commit 4ab830c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/vst.R
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ vst <- function(umi,
if (show_progress) {
pb <- txtProgressBar(min = 0, max = max_bin, style = 3)
}
res <- matrix(NA, length(genes), nrow(regressor_data_final), dimnames = list(genes, rownames(regressor_data_final)))
res <- matrix(NA_real_, length(genes), nrow(regressor_data_final), dimnames = list(genes, rownames(regressor_data_final)))
for (i in 1:max_bin) {
genes_bin <- genes[bin_ind == i]
mu <- exp(tcrossprod(model_pars_final[genes_bin, -1, drop=FALSE], regressor_data_final))
Expand Down Expand Up @@ -406,7 +406,7 @@ reg_model_pars <- function(model_pars, genes_log_mean_step1, genes_log_mean, cel

# take results from step 1 and fit/predict parameters to all genes
o <- order(x_points)
model_pars_fit <- matrix(NA, length(genes), ncol(model_pars),
model_pars_fit <- matrix(NA_real_, length(genes), ncol(model_pars),
dimnames = list(genes, colnames(model_pars)))

# fit / regularize theta
Expand Down

0 comments on commit 4ab830c

Please sign in to comment.