This directory contains all of the files you need to work through the R decomp tutorial to run statistics and produce publication-quality figures.

Files in this directory

- 04_code.Rproj
    - This is the R project file that opens the tutorial as a self-contained project.
- decomp_stats_figures.Rmd
    - This is the R Markdown file that contains the tutorial you will work through. It is located in the 04_code directory.
- metadata.txt
    - This is the metadata from your project. It should contain the sample ID and any other information needed to complete downstream analysis. The more data, the better. This file is located in 03_metadata.
- Diversity metrics: evenness.tsv, faith_pd.tsv, observed_features.tsv, shannon.tsv, bray_curtis.txt, jaccard.txt, unweighted_unifrac.txt, weighted_unifrac.txt, tabulated_results.tsv
    - These are the exported diversity metric files. They are located in the 04_code directory under the corresponding metric folders (alpha_div, beta_div, and taxonomy).
    The metrics are stored in 04_code to simplify file paths for the tutorial, but they could also be placed in 02_rawdata or another data directory.
- Figures generated by the R Markdown are saved into the 05_figures directory using ggsave().

To start the analysis, first click the 04_code.Rproj file in the 04_code directory. This will open an R project.

An R project helps bundle your work into a portable, self-contained folder. Within the project, all relevant scripts, data files, figures, outputs, and history are stored in subfolders, and the working directory is the project root.

Once the R project is open, you should initially see three panels in RStudio. In the bottom-right panel, click the Files tab, and you should see decomp_stats_figures.Rmd. Click decomp_stats_figures.Rmd, and a fourth panel in the upper-left will open. This is the R Markdown file you will work through for the stats and figures tutorial.

This Markdown file contains non-code chunks where instructions, explanations, and notes are written. These chunks are white. There are also code chunks, which contain executable code. To run these chunks, press the green play button in the upper-right corner of the chunk. To run individual lines in a chunk, highlight the line or place your cursor on the line you want to run and press Ctrl + Enter on Windows/Linux or Cmd + Enter on Mac.

It is important to execute the code chunks in the order they are presented. Running them out of order can cause errors because data may not have been loaded or cleaned before the code runs.

Once you are done working make sure to save any changes you have made. 

