Previous steps

If you would like to return to information from the previous section, please click here.

Context

One of the powerful uses of R and setting up a data repository for processing coral reef monitoring data is the ability to produce reports, slide presentations and other dissemination materials by directly linking with outputs from analysis and visualisation.

One way to evaluate participants’ skills obtained during this course, this Homework aims to provide a course exam that joins skills obtained in previous modules (e.g. “Formatting”, “Visualisation” and “Mapping”).

This wiki page provides an overview of the exercise for creating an example report of coral reef monitoring data. Participants’ example reports will be used to evaluate the skills obtained during this course.

Help for rmarkdown for this excersice can be found here

Set up

Similar to previous Homework exercises, we need to get set up:

 ## -- create local copy of homework scripts -- ##
  # Instructions:
  #  * 1.1. Copy homework script to your `participants_code` folder:
  #         copy `exercise_code/course_exam.R` to
  #           the `exercise_code` folder in `participants_code/`

  #  * 1.2. Create a new script in your `participants_code` folder in
  #          `reporting` to begin an example report, e.g.:
  #           course_exam_{your initials}.Rmd

 ## -- commit changes and push to Github -- ##
  # Instructions:
  #  * 1.3. In Gitbash or Git interface with RStudio:
  #           git add -A
  #           git status  ## -- this verifies local changes in staging area -- ##
  #           git commit -m 'adding local copy of homework exercises for 11 july'
  #           git pull    ## -- this ensures your local copy is up-to-date -- ##
  #           git push    ## -- this uploads your changes to github -- ##

Using RMarkdown

Starting a new *.Rmd script, adding a header provides the basic instructions for the creation of the document, including metadata of the document title, date, type of document, et cetera. Something like:

---
title: "Example title"
subtitle: "just in case you want one"
date: "include date"
author: your name
documentclass: article
classoption: a4paper
fontsize: 12pt
geometry: margin=2.5cm
output:
  pdf_document:
    fig_caption: yes
tables: true
bibliography: refs.bib
csl: ecology.csl
---

Adding report sections for this exercise could include:

  # Instructions:
  #  * 2.2. Add sections to your document, including:
  #          i.   Introduction
  #          ii.  Regional context
  #          iii. Taxonomic richess
  #          iv.  Temporal trends
  #          v.   Spatial patterns
  #          vi.  Conclusions & recommendations
  #          vii. References

Add supporting figures from previous homework to align with each section, including:

  #  * 2.3. Add supporting figures:
  #           From your previous Homework and exercises, add
  #             figures and supporting materials including:
  #           i.   Regional site map
  #           ii.  Time series of changes in coral cover
  #                or fish abundance
  #           iii. "Zoom" of monitoring sites (e.g. Kenya)
  #                with an aesthetic to visualise percent
  #                cover or abundance
  #         Hint: Import individual figures to your *.Rmd
  #               file using the example notation:
# ![Example plot title](path/to/your/figure.png)

To include a summary table of taxonomic richness can be found in previous homework exercises:

  #  * 2.4. Using tables:
  #           In one of your `participants_code` homework scripts,
  #             create a summary of the number of taxa of
  #             sessile categories or fish using:
  #           knitr::kable()
  #             and include output in your *.Rmd file
  #         Hint:  One can use a code chunk to load() an *.rda
  #           file, summarise and print to table, e.g.
  # ```{r, echo=FALSE, results='asis'}
  # library(dplyr)
  # reef_data %>% group_by(site) %>% summarise(cover = cover %>% mean(na.rm = TRUE)) %>% knitr::kable()
  # ```

Including references in the document for figures and literature citations is a useful skill to have. As part of this exercise, practise including these in your example report:

  #  * 2.5. Document references
  #         i. Provide 2-3 sentences of supporting text for each of your
  #             document sections and use the notation:
  #           \ref{figurename} and \label{figurename}
  #             to reference the use of your figures.
  #           Hint:  the \label{} notation is included in the plot title:
# ![Example plot title. \lable{figurename}](path/to/your/figure.png)
  #         ii. Use the example references to include citations, e.g.:
  #            @spalding2007
  #           Hint: example references are included in the `ref.bib` file

Lastly, compile the document:

  #  * 2.6. Compile document
  #         Using the "Knit" button in RStudio or rmarkdown::render()
  #          create a *.pdf of your report and it should look
  #          fantastic!

Including the reporting workflow in integrate.R

In order to document the production of your report, use your personal copy of integrate.R to sequence the steps for data cleaning, figure production, et cetera:

  # Instructions:
  #  * 3.1. Using your personal copy of `integrate.R` in your `participants_code`
  #          folder and ensure that it includes:
  #            1. `source()` to the `creation_code` for your core objects
  #                  used in your report
  #            2. `source()` to the analysis_code script for creating the
  #                  regional map, trend plots, and local abundance site map.
  #                 Also include the script that does the taxa summary for
  #                  your table.
  #         Hint: if you have been keeping up with your Homework, this should
  #                 already be there (including example taxa summaries from
  #                   `create_kenya_fishes_data.R` and others)
  #            3. Include code to create your example report from `integrate.R`
  #                 This can be done by pointing to your `reporting` folder
  #                   and using `rmarkdown::render()` or creating a separate
  #                   script that does the same and using `source()`
  #         Hint: Creating a separate script for the `render()` can help
  #                 ensuring directories and computer specific settings
  #                 are correct.

Submit course exam for evaluation

Similar to previous Homework exercises, use git to submit your results:

  # Instructions:
  #  * 4.1. In Gitbash or Git interface with RStudio:
  #           git add -A  ## -- this adds your work to the staging area -- ##
  #           git status  ## -- this verifies local changes in staging area -- ##
  #           git commit -m 'submitting course exam for {include your shortname}'
  #           git pull    ## -- this ensures your local copy is up-to-date -- ##
  #           git push    ## -- this uploads your changes to github -- ##