From eef5af42193c28f2fd4fbb498dd78e64ba96c9ab Mon Sep 17 00:00:00 2001 From: JTPetter <61797391+JTPetter@users.noreply.github.com> Date: Fri, 9 Aug 2024 14:05:12 +0200 Subject: [PATCH] Fix 2867 --- R/msaGaugeRR.R | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/R/msaGaugeRR.R b/R/msaGaugeRR.R index 8fb64b61..652e4984 100644 --- a/R/msaGaugeRR.R +++ b/R/msaGaugeRR.R @@ -456,7 +456,7 @@ msaGaugeRR <- function(jaspResults, dataset, options, ...) { if (singleOperator || interactionSignificant){ #r & R varcomps - if(singleOperator){ + if (singleOperator) { varCompList <- .gaugeCrossedVarCompsSingleOP(data, operators, parts, measurements, msPart, msRepWithInteraction) varCompRepeat <- varCompList$repeatability varCompPart <- varCompList$part @@ -464,7 +464,7 @@ msaGaugeRR <- function(jaspResults, dataset, options, ...) { varCompTotalVar <- varCompList$totalVar varCompVector <- c(varCompTotalGauge, varCompRepeat, varCompPart, varCompTotalVar) sources <- gettext(c("Total gauge r&R", "Repeatability", "Part-to-part", "Total variation")) - }else { + } else { varCompList <- .gaugeCrossedVarComps(data, operators, parts, measurements, msPart, msOperator, msRepWithInteraction, msInteraction) varCompRepeat <- varCompList$repeatability varCompOperator <- varCompList$operator @@ -989,11 +989,14 @@ msaGaugeRR <- function(jaspResults, dataset, options, ...) { interaction <- (msInteraction - msRep) / nReplicates part <- (msPart - msInteraction) / (nOperators * nReplicates) reprod <- operator + interaction - }else{ + } else { operator <- (msOperator - msRep) / (nParts * nReplicates) part <- (msPart - msRep) / (nOperators * nReplicates) reprod <- operator } + operator <- max(0, operator) + part <- max(0, part) + reprod <- max(0, reprod) totalGauge <- repeatability + reprod totalVar <- totalGauge + part varcompList <- list(repeatability = repeatability,