From 575587e8182e619643adc844bc04ceaa78316f87 Mon Sep 17 00:00:00 2001 From: ShaiberAlon Date: Wed, 18 Aug 2021 16:19:40 -0400 Subject: [PATCH] use cbind2 for dgCMatrix. For some reason sometimes we need to excplicitly use cbind2 to avoid R trying to apply the data.frame cbind and attempt to coerce the dgCMatrix to a data.frame --- R/apps.R | 2 +- R/gGnome.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/apps.R b/R/apps.R index c3977e5b..ec22e530 100644 --- a/R/apps.R +++ b/R/apps.R @@ -2829,7 +2829,7 @@ fitcn = function (gw, cn.field = "cn", trim = TRUE, weight = NULL, obs.mat = NUL ) A = rbind( ## cbind(K, Zero[rep(1, nrow(K)), (w + 1:w)]), - cbind(Reduce(`diagc`, lapply(seq_len(nblock), function(i) K)), Zero[rep(1, nrow(K) * nblock), (w + 1:w)]), + cbind2(Reduce(`diagc`, lapply(seq_len(nblock), function(i) K)), Zero[rep(1, nrow(K) * nblock), (w + 1:w)]), Amub, Amlb ) diff --git a/R/gGnome.R b/R/gGnome.R index 0760b4ce..d8be7a8b 100644 --- a/R/gGnome.R +++ b/R/gGnome.R @@ -7928,7 +7928,7 @@ gWalk = R6::R6Class("gWalk", ## GWALKS ## lower bound > 0 if indicator is positive Amlb = cbind(diag(rep(1, w)), diag(rep(-0.1, w))) - A = rbind(cbind(K, Zero[rep(1, nrow(K)), (w+1:w)]), Amub, Amlb) + A = rbind(cbind2(K, Zero[rep(1, nrow(K)), (w+1:w)]), Amub, Amlb) return(A) }