---
title: 'Annual Report for Iris Explorer'
output: html_document
params:
  user: 
    label: "User"
    value: "Bilbo"
    placeholder: "Enter user name"
  year:
    label: "Year"
    value: 2017
    input: slider
    min: 2010
    max: 2018
    step: 1
    sep: ""
  file: 
   input: file
   label: "Choose RDS"
   value: ""
   accept: ".rds"
   multiple: FALSE
   buttonLabel: "Browse to analysis output..."
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(knitr)
ps <- readRDS(params$file)
```

This report summarizes an analysis of iris data by 
`r params$user` conducted  in `r params$year`. Iris 
data was clustered into `r ps$'mod2-clusters'` groups 
based on `r ps$'mod2-xcol'` and `r ps$'mod2-ycol'`. 
A random sample of  `r ps$'mod3-sample_num'` records 
were collected, with sample sizes shown in the pie
chart below:

```{r}
pie_data <- table(ps$returns$data2$subset_data$cluster)
pie(
  x = pie_data,
  labels = as.character(pie_data), 
  col = rainbow(length(pie_data)),
  main = "Number of random samples by cluster"
)
legend(
  x = "topright", 
  legend = names(pie_data), 
  fill = rainbow(length(pie_data))
)


```

Some things to note about this analysis are:  `r ps$notes`

Respectfully submitted,

Gandalf
