---
title: '&nbsp;'
title-meta: "Stability-Report"
params:
  Stability: NA
  Options: NA
output:
  html_document:
    df_print: paged
---

***Note!*** 
This is a general report template. Specific layouts can be generated on demand.

---

## ***eCerto*** Report

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

### Modul: Stability

```{r data, echo=FALSE}
# get a local representation of all data provided by Shiny
testing <- length(params$Stability)==1L && (is.na(params$Stability) | params$Stability=="NA")
if (testing) {
  S <- eCerto::CRM001[["Stability"]]
  O <- list(
    "apm" = NULL,
    "U_Def" = input$s_sel_dev,
    "mt" = getValue(rv, c("General", "materialtabelle")),
    "type" = 1,
    "t_cert" = 60,
    "slope_of_means" = FALSE,
    "show_legend" = TRUE
  )
} else {
  S <- params$Stability
  O <- params$Options
}
an <- as.character(S[["s_vals"]][,"analyte"])
```

This is the table of uncertainties associated with Stability:

```{r Tab.S1, echo=FALSE, comment=NA, message=FALSE, warning=FALSE}
eCerto:::styleTabS1(x = S[["s_vals"]], mt = data.frame("analyte"=an))
```

`r ifelse(length(an)>=2, "These are the individual Stability boxplots:", "This is the Stability boxplot:")`

```{r Fig.S1, echo=FALSE, comment=NA, message=FALSE}
# make individual plots to allow separate inclusion in i.e. Word reports
for (i in 1:length(an)) {
  try(
    eCerto:::plot_lts_data(
      x = eCerto:::prepFigS1(
        #s = S[["data"]],
        s = O[["s_Data"]],
        an = an[i],
        apm = O[["apm"]],
        U_Def = O[["U_Def"]],
        mt = O[["mt"]]
      ),
      type = O[["type"]],
      t_cert = O[["t_cert"]],
      slope_of_means = O[["slope_of_means"]],
      show_legend = O[["show_legend"]]
    )
  )
}
```

This is the table of (non rounded) input data from the original file ***`r S[["input_files"]]`***:

```{r FullData, echo=FALSE, comment=NA}
DT::datatable(data = S[["data"]], rownames = NULL, options = list(dom = "t", paging = FALSE))
```

End of Report.