---
title: "analysis_and_plots"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{analysis_and_plots}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, echo=FALSE}
library(CoreMicro)
library(gt)
library(tidyr)
```

# Introduction

Comes with arabidopsis dataset - blah blah

```{r, results='hide'}
arabidopsis
```

# Data Structure for {CoreMico}

By default {coremicro} assumes your data is in a wide format:

```{r, echo=FALSE, warning=FALSE}
tibble(
  X = c("OTU_1", "OTU_2", "OTU_3"),
  site_1 = c(0,10,20),
  site_2 = c(20,1,20)
) %>% gt()
```

Where the first column is your taxa names, and all subsequent columns are numeric containing your taxa counts. If your data is in long format you can set `taxa_as_rows = FALSE`

# Mean, Variance, Covariance

What is this... 

```{r}
summarise_taxa(arabidopsis)
```

# Single Methods

We can use the built in `arabidopsis` dataset to look at each of the core methods included in the package thusfar:

### Hard Cutoff

What this method is, arguments you can change 

```{r, eval=FALSE}
hard_cutoff(arabidopsis)
```

### Proportion of Sequence Reads 

What this method is, arguments you can change 

```{r, eval=FALSE}
prop_reads(arabidopsis)
```

### Proportion of Sequence Replicates

What this method is, arguments you can change 

```{r, eval=FALSE}
prop_reps(arabidopsis)
```

### Proportion of Sequence Reads and Replicates

What this method is, arguments you can change 

```{r, eval=FALSE}
prop_reads_and_reps(arabidopsis)
```

We encourage collaboration -- please submit a PR or issue if you'd like to see more methods included in the package!

# All Methods

The main function of the package is `combine_methods`, a function which prints your taxa table and a `logical` column for each method if that taxa is included in the column's method. It also adds the class `core_methods` to your dataset so it can be used in subsequent plotting:

```{r}
(
combine_arab <- core_methods(arabidopsis)
)
```


# Plot

## Histo-bins

This function takes on the output of `core_methods`. This plot........ The function has one neccessary argument, `combined_otu_data`, but you can include the low and high colors for hex fills as well as a more informative legend title: 

```{r, fig.width=9, fig.height=3}
core_plots(combine_arab, high= "#1B301E", low = "#E1E4E1", legend_title = "Arabidopsis Taxa Count")
```

## Venn Diagram

Explanation

```{r}
combine_arab %>% core_venn()
```
