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

```{r setup, include=FALSE}
library(EcoNiche)
set.seed(1)

otu <- matrix(rpois(20*25, 5), nrow = 20)
rownames(otu) <- paste0("OTU", 1:20)
colnames(otu) <- paste0("S", 1:25)

env <- data.frame(
  Temp = rnorm(25, 15, 3),
  pH   = rnorm(25, 6.5, 0.4),
  SOC  = rlnorm(25, 2, 0.3)
)
rownames(env) <- colnames(otu)

res <- cca_workflow(
  mode = "gradient",
  otu = otu, env = env,
  sel = c("Temp", "pH"),
  covariates = "SOC",
  make_plot = FALSE,
  top_node = 20
)

str(res$step3, max.level = 1)
```

This vignette will document the CoNiche workflows (CCA/GAM/Levins).
Use toy data examples to keep build times short for CRAN.
