"

knitr::opts_chunk$set(echo = FALSE)
#knitr::opts_chunk$set(out.width = '100%', dpi=300)
word_tabs_as_fig <- !knitr::is_html_output() && requireNamespace("webshot2", quietly = TRUE)
if (word_tabs_as_fig) library(webshot2)
fs_tab <- "175%"
prec <- params$V_pars$opt_tabV1_precision
ab <- eCerto:::prepDataV1(tab=params$inp_data, a = params$V_pars$opt_figV1_anal, l = params$V_pars$opt_figV1_level, fmt = "rel_norm")
fig_V1_width <- eCerto:::calc_bxp_width(n = length(params$V_pars$opt_figV1_anal)*length(params$V_pars$opt_figV1_level), w_point = 28, w_axes = 120)
tab_v1 <- eCerto:::prepTabV1(
  tab = eCerto:::flt_Vdata(
    x = params$inp_data, 
    l = if (params$V_pars$opt_tabV1_useLevels) params$V_pars$opt_figV1_level else NULL, 
    a = if (params$V_pars$opt_tabV1_useAnalytes) params$V_pars$opt_figV1_anal else NULL
  ),
  alpha = params$V_pars$opt_tabV1_alpha,
  k = params$V_pars$opt_tabV1_k,
  flt_outliers = params$V_pars$opt_tabV1_fltLevels,
  unit_cali = params$V_pars$opt_tabV1_unitcali,
  unit_smpl = params$V_pars$opt_tabV1_unitsmpl,
  conv_fac = params$V_pars$opt_tabV1_convfac
)
  knitr::include_graphics(params$logo_file)

eCerto Report

Date: r format(Sys.time(), '%d %B, %Y')

Modul: Method validation

  cat(params$helptext_v_fig_V1, sep = "\n")
  eCerto:::prepFigV1(ab = ab)

The working range concentrations within the solutions and samples, respectively, are provided in the following table.

tab_V1_wr <- eCerto:::style_tabV1(df = tab_v1, precision = prec, selected = NULL, interact_ele = FALSE, show_colgroups = "wr")
if (knitr::is_html_output()) {
  tab_V1_wr
} else {
  colnames(tab_V1_wr$x$data) <- eCerto:::HTML2markdown(colnames(tab_V1_wr$x$data))
  knitr::kable(tab_V1_wr$x$data, digits = prec)
}
if (word_tabs_as_fig) eCerto:::style_tabV1(df = tab_v1, precision = prec, selected = NULL, interact_ele = FALSE, font.size = fs_tab, show_colgroups = "wr")

In the following, detailed plots for the levels determining the working range for each analyte are presented.

  inp <- params$inp_data
  tab <- tab_v1
  as <- tab$Analyte
  for (a in as) {
    L_min <- tab[tab$Analyte==a,"c_WR_min"]
    L_max <- tab[tab$Analyte==a,"c_WR_max"]
    Ls <- sapply(c(L_min, L_max), function(x) {
      unique(inp[inp[,"Analyte"]==a & abs(inp[,"Concentration"]-as.numeric(x))<0.001,"Level"])[1]
    })
    flt <- inp[,"Analyte"] %in% a & inp[,"Level"] %in% Ls
    eCerto:::prepFigV3(x = inp[flt,,drop=FALSE], cex = 1)
  }

\newpage

  cat(params$helptext_v_tab_V1, sep = "\n")

Linear model parameters for all analytes are provided in the following table.

tab_V1_lm <- eCerto:::style_tabV1(df = tab_v1, precision = prec, selected = NULL, interact_ele = FALSE, show_colgroups = "lm")
if (knitr::is_html_output()) {
  tab_V1_lm
} else {
  colnames(tab_V1_lm$x$data) <- eCerto:::HTML2markdown(colnames(tab_V1_lm$x$data))
  knitr::kable(tab_V1_lm$x$data, digits = prec, caption = tab_V1_lm$x$caption)
}
if (word_tabs_as_fig) eCerto:::style_tabV1(df = tab_v1, precision = prec, selected = NULL, interact_ele = FALSE, font.size = fs_tab, show_colgroups = "lm")

In the following, detailed plots comparing linear and quadratic model fits for each analyte are presented.

  inp <- params$inp_data
  tab <- tab_v1
  flt_outliers <- length(grep("^[(]", tab[,"F_Test"]))>=1
  as <- tab$Analyte
  for (a in as) {
    L_min <- tab[tab$Analyte==a,"c_WR_min"]
    L_max <- tab[tab$Analyte==a,"c_WR_max"]
    Ls <- sapply(c(L_min, L_max), function(x) {
      unique(inp[inp[,"Analyte"]==a & abs(inp[,"Concentration"]-as.numeric(x))<0.001,"Level"])[1]
    })
    #idx <- as.numeric(levels(inp[,"Level"])[which(levels(inp[,"Level"]) %in% Ls)])
    idx <- which(levels(inp[,"Level"]) %in% Ls)
    Ls <- levels(inp[,"Level"])[idx[1]:idx[2]]
    flt <- inp[,"Analyte"] %in% a & inp[,"Level"] %in% Ls
    eCerto:::prepFigV2(tab = inp[flt,,drop=FALSE], a = a, flt_outliers = flt_outliers, cex = 1)
  }

\newpage

Limit of Detection and Quantification

Based on the linear models specified above the following LOD and LOQ values were determined for all analytes.

  tab_V1_lox <- eCerto:::style_tabV1(df = tab_v1, precision = prec, selected = NULL, interact_ele = FALSE, show_colgroups = "lo")
  if (knitr::is_html_output()) {
    tab_V1_lox
  } else {
    knitr::kable(tab_V1_lox$x$data, digits = prec)
  }
if (word_tabs_as_fig) eCerto:::style_tabV1(df = tab_v1, precision = prec, selected = NULL, interact_ele = FALSE, font.size = fs_tab, show_colgroups = "lo")

\newpage

Trueness

  cat(params$V_pars$txt_trueness, sep = "\n")

\newpage

Precision

  cat(params$V_pars$txt_precision, sep = "\n")

\newpage

Measurement Uncertainty

  cat(params$V_pars$txt_uncertainty, sep = "\n")

\newpage

  cat(params$helptext_v_formula_collection, sep = "\n")

\newpage

Input data for reference

Finally, this is the input data table as used internally for all calculations.

inp <- params$inp_data
inp <- inp[inp[,"Analyte"] %in% tab_v1$Analyte,]
inp <- inp[, !(colnames(inp) %in% c("Type", "Exclude_Level", "Exclude_Sample", "norm", "rel_norm"))]
if (knitr::is_html_output()) {
  DT::datatable(
    data = inp, rownames = FALSE, extensions = "Buttons", 
    options = list(dom = "Bt", pageLength = -1, buttons = list(list(extend = "excel", text = "Excel", title = NULL)))
  )
} else {
  knitr::kable(inp, row.names = FALSE, digits = prec+1)
}


Try the eCerto package in your browser

Any scripts or data that you put into this service are public.

eCerto documentation built on April 12, 2025, 9:13 a.m.