Skip to content

Commit cb3216a

Browse files
committed
fix sporadic error when only 1 sigma is detected because of NA estimates
1 parent c1a01b9 commit cb3216a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

R/testNhoods.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,8 @@ testNhoods <- function(x, design, design.df, kinship=NULL,
576576
"Logliklihood"=unlist(lapply(fit, `[[`, "LOGLIHOOD")))
577577

578578
# need to know how many variance components there are to get proper data frame dimensions
579-
n.sigmas <- unique(unlist(lapply(lapply(fit, `[[`, "Sigma"), length)))
579+
# sometimes calling unique on the length of sigmas returns two values - because there are NAs?
580+
n.sigmas <- max(unique(unlist(lapply(lapply(fit, `[[`, "Sigma"), length))))
580581
varcomps <- as.data.frame(matrix(unlist(lapply(fit, `[[`, "Sigma")), ncol=n.sigmas, byrow=TRUE))
581582

582583
if(n.sigmas == length(rand.levels)){

0 commit comments

Comments
 (0)