Recommendation Report Template

Please use the following template for this assignment:

20220101_Lab05_125_Assignment_V1.Rmd (3 KB)

You will need to submit 4 files for this assignment:

  • Recommendation report as .Rmd
  • Recommendation report as .pdf
  • Data in long, tidy, format as .csv
  • Data dictionary as .md

You will receive your marked lab report one week from the time it is submitted.

You can decide to resubmit the same lab report draft without making any changes or you will have the opportunity to review the edits and make the needed changes in order to increase your mark.

If you have any questions regarding your mark and / or the comments from your TA please ensure you take the opportunity to chat with your TA to go over these. This will ensure that you are in the best position to attain the highest marks possible for this assignment.

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, and your figures. 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 convention you outlined in your first assignment.

This structure and hierarchy will be important when it comes time to include figures and images in your report.

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 included. Note how it references the figure to be included ../figures/image-name.png The ../ means 'go one level up in the directory' which, if you have your project set up in the following way and your .Rmd file is in your report/ directory it means 'look in the root/ directory for a folder called figures/.

root/
  report/20220101_Lab05_125_Assignment_V1.Rmd
  data/
  figures/MVD_BIOL125-Lab5_Fig-1-Boxplot_V1.png

If you make a mistake in setting this path, you'll get the following error in RStudio

(No image at path ...)

You’ll also note the following directly after the image path: {width=50%}. This reduces the image size by 50%. This works well for the images produced by the ShinyApp used in this course.

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.

To test this with the template, ensure the template .Rmd file is in your report/ directory and download the following image into your figures/ directory

You should get something that looks like this after Knitting the .Rmd file