because com.idx has length 1, and beta[com.idx,which(pheno==Compare[[i]][1])] instead of a matrix becomes a vector, over which cannot be computed row names. By adding drop=FALSE, we can make it return a matrix with one row, and the operation works.
In the patch I've also removing the use of which() as it seems unnecessary. The only case where it would make a difference is if pheno or Compare contain NAs, but I don't know if that is actually possible. In case, I can put the 'which()' back.
When running
champ.DMP()
, if there is only one differentially expressed probe, the following fails:because
com.idx
has length 1, andbeta[com.idx,which(pheno==Compare[[i]][1])]
instead of a matrix becomes a vector, over which cannot be computed row names. By addingdrop=FALSE
, we can make it return a matrix with one row, and the operation works.In the patch I've also removing the use of
which()
as it seems unnecessary. The only case where it would make a difference is ifpheno
orCompare
contain NAs, but I don't know if that is actually possible. In case, I can put the 'which()' back.