To practice, we will write a short paper about a data set on 3 different penguin species (Chinstrap, Gentoo, and Adelie) on islands in Antarctica. As we progress in the workshop, we will incorporate more options, functionality and formatting into the document.
The data is available from the palmerpenguins package. To get it, you have to open RStudio and:
install.packages("palmerpenguins")
Take a minute to get familiar with the data set and its variables (if you already know the data you can also skip this step):
library(palmerpenguins)
(just do this in the console)penguins
into the console and you should see the penguins tibbleWe will need the data later, so remember that you can access it via the variable penguins
.
For all the tasks of today, you might find it helpful to look at the R Markdown
cheat sheet and the R Markdown reference guide. You can find them from inside RStudio by clicking on
Help -> Cheat Sheets -> R Markdown Cheat Sheet / R Markdown Reference Guide
Now go back to the template document, you created in the previous task.
In this document, we start writing the paper about the 3 penguins.
First, remove all template text except the YAML header and the first code chunk (we will learn later what that does).
Have another look at the example document we just discussed together.
Now try to reproduce this document in your own Rmarkdown file.
The point of this task is to include many different markdown formatting elements.
So you can copy paste my text and add the formatting elements. Find the links that I used below.
During the writing process, don’t forget to knit your document often. It’s easier to fix mistakes and error messages if you detect them early. For this task, only use HTML output for now.
Here are the links that I used in the text for URL links and the figure.
Add your own text and more formatting. Have a look at the
Write with Markdown
section of the R Markdown cheat sheet or the R Markdown reference guide to find examples for more
markdown elements to use.