---
title: "Explore"
output: html_document
---

## Describe Raw Data

```{r echo=FALSE, message=FALSE, warning=FALSE}
data %>% describe_tbl()
d <- describe(data)
knitr::kable(d)
```

## Describe Count Data

Variable `r var_name_n` is used as count-data

```{r echo=FALSE, message=FALSE, warning=FALSE}
describe_tbl(data, n = !!sym(var_name_n))
```


## Describe Target

```{r fig.height=3, echo=FALSE, fig.height=3, fig.width=5, message=FALSE, warning=FALSE}
data %>% explore(!!sym(var_name_target), n = !!sym(var_name_n), 
                 color = color_report_plot)
```

## Explore Variables

```{r include=FALSE}
# create buckets of variables
buckets <- data %>% 
  explore::get_var_buckets(
    var_name_target = var_name_target,
    var_name_n = var_name_n,
    bucket_size = 100
  )

# height of each plot
fig_height <- data[buckets[[1]]] %>% 
  explore::total_fig_height(var_name_n = var_name_n)

```

```{r echo=FALSE, fig.height=fig_height, fig.width=10, message=FALSE, warning=FALSE}
for (i in seq_along(buckets)) {
  data[buckets[[i]]] %>% 
    explore_all(ncol = 2, n = !!sym(var_name_n), target = !!sym(var_name_target), split = TRUE, color = color_report_plot)
}
```
