Skip to content

Commit

Permalink
Catching an error in Tab.C2 when uploaded data contain only single …
Browse files Browse the repository at this point in the history
…Lab for specific analyte.
  • Loading branch information
janlisec committed Apr 3, 2024
1 parent 1140589 commit 5a3b16a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/fnc_prepTabC2.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ prepTabC2 <- function(dat=NULL, excl_labs=FALSE) {
dat[,"Lab"] <- factor(dat[,"Lab"])
}
x <- sapply(split(dat$value, dat$Lab), mean)
if (shiny::isRunning()) {
shiny::validate(shiny::need(expr = length(x)>1, message = "No statistics for single Lab possible."))
} else {
stopifnot(length(x)>1)
}
out <- data.frame(
"Mean" = mean(x),
"Median" = stats::median(x),
Expand Down

0 comments on commit 5a3b16a

Please sign in to comment.