Skip to content

Commit

Permalink
use cbind2 for dgCMatrix. For some reason sometimes we need to excpli…
Browse files Browse the repository at this point in the history
…citly use cbind2 to avoid R trying to apply the data.frame cbind and attempt to coerce the dgCMatrix to a data.frame
  • Loading branch information
ShaiberAlon committed Aug 18, 2021
1 parent bb05da4 commit 575587e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/apps.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
2 changes: 1 addition & 1 deletion R/gGnome.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 575587e

Please sign in to comment.