Assignment Template

You will use the following template for your protocol:

BIOL205_Lab03_Assignment3.Rmd

Before starting your protocol, we’ll spend some time reviewing the different parts of this template.

Using the Template

All the markdown syntax that you need for RMarkdown can be found in the Markdown section of the BIOL Procedures and Guidelines.

Directory Structure & File Naming

It is expected that you will have a root project folder for your work associated with this lab. And that at the minimum you will have a folder for your report, your data, your figures, and your scripts. And that you will download this template into your report/ directory. And that lastly, you will rename the template in accordance with the file naming conventions in the Biology Procedures and Guidelines document.

Lastly, we’ll be working with an RProject file this round to help ensure our project’s working directory is properly set up in R.

It's important to load your project using the RProject file and not the RMarkdown file to ensure your working directory is properly set and that all the scripts and templates we’ll be using work as intended!

Review the instruction here in the Procedures and Guidelines Document, for setting up a working directory and RProject file.

Your project directory structure should look something like this once you’ve created your RProject file and you’ve downloaded a copy of the RMarkdown file:

├── BIOL205_RP/
│   ├── BIOL205_report.RProj
│   ├── data/
│   ├── figures/
│   ├── report/
│   │   ├── 20220101_Lab03_205_Assignment_V1.Rmd
│   ├── scripts/

YAML

The top of the template contains some front matter called YAML. YAML provides instructions to all the pieces of software involved in converting your RMarkdown document to it's outputs, in this case, pdf. YAML is very specific to spacing, so don't add any extra spaces!

What you need to do.

  1. Provide a title within the quotations after title.
  2. Provide your name within the quotations after author.
  3. Provide your abstract within the quotations after abstract.

What might be nice to know.

  1. r Sys.Date() pulls the date from your computer and auto populates this for you.
  2. The output tag defines the output format. Other options include html_document and word_document.

What exactly is YAML?

YAML™ (rhymes with “camel”) is a human-friendly, cross language, Unicode based data serialization language designed around the common native data types of dynamic programming languages. It is broadly useful for programming needs ranging from configuration files to internet messaging to object persistence to data auditing and visualization.

Read more at the Official YAML Web Site

Document Body

The template is then pre-populated with first level headers for each section you're expected to include in your report. Each heading re-iterates the key elements the content of these headings should address. This is just place holder text, so replace it with your own.

Images & Graphs

There is one sample graph referenced in the template. If you'd like to download this image and place it in your figures/ directory to test knitting your template, the file can be downloaded at this link. And your project should look like this:

├── BIOL205_RP/
│   ├── BIOL205_report.RProj
│   ├── data/
│   ├── figures/
│   │   ├── MVD_BIOL125-Lab5_Fig-1-Boxplot_V1.png
│   ├── report/
│   │   ├── 20220101_Lab03_205_Assignment_V1.Rmd
│   ├── scripts/

You might note the following directly after the image path: {width=50%}. This reduces the image size by 50%.

As noted in the template, you do not need to write Figure 1: before your figures; this small piece of text is handled during the conversion from RMarkdown to pdf. Any other information that you would like to include in the caption should go in the [] before the () that contain the path to the image.

Figure placement

The engine behind the conversion from RMarkdown to pdf is a typesetting application, one with pretty strict rules about how content should be formatted - much more strict than something like Microsoft Word.

What this means is that if the placement of your images will disrupt your prose - by creating large amounts of empty white space for example - this typesetting application will push your figure to somewhere lower in your report where it won't create this white space.

Your figures should be adjacent to the relevant text in your RMarkdown file. How this manifests to your pdf might look a little different; that's ok.

References

Just before the heading for references you'll see the following

\clearpage

This creates a page break between your references section and the rest of your report.

Building the pdf

If you’ve installed R, RStudio, and the markdown and tinytex packages succesfully, when you open the template .Rmd file you should see an option to Knit.

Click this button or select the drop down arrow and select Knit to pdf. This will generate a pdf in the same directory as your .Rmd file.