---
title: "StepReg report"
output: html_document
date: today
params:
  modelSelection: NA
  selectionPlot: NA
  modelVote: NA
  relValue: NA
---

```{r include = FALSE}
knitr::opts_chunk$set(echo=FALSE)
library(ggplot2)
library(stringr)
library(flextable)
```

## {.tabset}

### Statistics

**Statistics of Variable Selection:**

```{r comment = NA}
params$modelSelection
nmetric <- length(unlist(str_split(params$modelSelection[[1]][3,2], "&")))
strategies <- length(unlist(str_split(params$modelSelection[[1]][2,2], "&")))
```

### Visualization

**Visualization of Variable Selection:**
```{r comment = NA, warning=FALSE, fig.width = 10, fig.height = 6 * nmetric}
for(i in names(params$selectionPlot)) {
  print(i)
  print(plot_grid(plotlist = c( rev(params$selectionPlot[[i]])), ncol = 1, rel_heights = c(1, as.numeric(params$relValue))))
}
```

### Model Vote

**Model Selection by Vote Across All Combinations of Strategy and Metric:**

```{r comment = NA}
flextable(params$modelVote)
```