---
title: "report"
author: "Pat Callahan"
date: "`r Sys.Date()`"
output: html_document
params:
  from_shiny_app: FALSE
  comparison_data: !expr list(run_info = NA, distribution_statistics = NA, distribution_plot = NA)
  group1_data: !expr list(run_info = NA, group1_t1error = NA)
  group2_data: !expr list(run_info = NA, group2_t1error = NA)
  rng_info: !expr list(rng_kind = NA, rng_normal_kind = NA, rng_sample_kind = NA)
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(
  echo = FALSE,
  message = FALSE,
  warning = FALSE
  )

if (params$from_shiny_app == FALSE) {
  ordinalsimr_data <- readRDS("ordinalsimr_results.rds")

  if (is.na(params$comparison_data$distribution_plot)) {
    unlockBinding("params", env = .GlobalEnv)
    params$comparison_data$distribution_plot <- try(ordinalsimr_data$comparison_data$distribution_plot)
    lockBinding("params", env = .GlobalEnv)
  }
  
  if (is.na(params$comparison_data$distribution_statistics)) {
    unlockBinding("params", env = .GlobalEnv)
    params$comparison_data$distribution_statistics <- try(ordinalsimr_data$comparison_data$distribution_statistics)
    lockBinding("params", env = .GlobalEnv)
  }
  
  if (is.na(params$comparison_data$run_info)) {
    unlockBinding("params", env = .GlobalEnv)
    params$comparison_data$run_info <- try(ordinalsimr_data$comparison_data$run_info)
    lockBinding("params", env = .GlobalEnv)
  }
  
  if (is.na(params$group1_data$run_info)) {
    unlockBinding("params", env = .GlobalEnv)
    params$group1_data$run_info <- try(ordinalsimr_data$group1_data$run_info)
    lockBinding("params", env = .GlobalEnv)
  }
  
  if (is.na(params$group1_data$group1_t1error)) {
    unlockBinding("params", env = .GlobalEnv)
    params$group1_data$group1_t1error <- try(ordinalsimr_data$group1_data$group1_t1error)
    lockBinding("params", env = .GlobalEnv)
  }
  
  if (is.na(params$group2_data$run_info)) {
    unlockBinding("params", env = .GlobalEnv)
    params$group2_data$run_info <- try(ordinalsimr_data$group2_data$run_info)
    lockBinding("params", env = .GlobalEnv)
  }
  
  if (is.na(params$group2_data$group2_t1error)) {
    unlockBinding("params", env = .GlobalEnv)
    params$group2_data$group2_t1error <- try(ordinalsimr_data$group2_data$group2_t1error)
    lockBinding("params", env = .GlobalEnv)
  }
  
}

```

## R Markdown

```{r, fig.width=12, fig.height=6}

params$comparison_data$distribution_plot +
  theme(
    legend.text = element_text(size = 8),
    legend.title = element_text(size = 10, face = "bold")
  )


```


```{r}
params$rng_info
```


