Aim of the Game

What you are looking at right now is a GitHub page. This is a website-like platform I have developed to complement whatever I blabbed about during the Ecolunch talk. Here I have been able to expand on things I did not have time to cover during the talk and add detailed instructions on how to do some cool stuff.

My goal here is to explain how you guys can use this kind of page as a way to develop your research work as well as having an amazing tool to share and present your results. If you want to see an example of someone who does that amazingly check: https://matthieu-bruneaux.gitlab.io/isotracer/

All pages here were made using R markdown in combination with an R package called pkgdown. In this page I’ll explain briefly how R markdown works, how to build a website like this and how to link it to your GitHub repositories so you can apply it to your research.

What is R markdown?

In the simplest way I can put it, R markdown is a type of R document that combines code with text to generate a website-like page (It is very similar to Jupyter Notebook, ask Trevor about that!). This page was made using R markdown and in it I can include chunks of code in between paragraphs that not only show the code used but also the output:

print("BITCONNEEEEEECT!")
## [1] "BITCONNEEEEEECT!"


If you, understandably, have no idea WTF is this about check: https://www.youtube.com/watch?v=yIL9wLxG01M".


To create your own R markdown documents (.Rmd) in your R studio session you can go to File-> New File -> R markdown.

I won’t extend too much on how to use it because Xie, Allaire & Grolemund wrote a fantastic free book that will tell you all about it: https://bookdown.org/yihui/rmarkdown/

How to build your website

Let’s say that your paper has a bunch of different analysis you need to explain. For each one, you make an R markdown document explaining it beautifully. It would be cool to have a website compiling all your very important stuff in one place right? Let me show you how to do it through these two very straightforward steps:

Step 1: Create a vignettes folder

Remember when we talked about the elements of your R package? (https://ggcostoya.github.io/cataract/articles/r_packages.html#elements-of-your-r-package-1) To generate a website you will need to create a folder called vignettes where you will store all the .Rmd documents you write.

Step 2: Generate the website

To do so you will need to type the following command on your R console:

pkgdown::build_site()


You will see that it takes a while to run but that once it is done the website will pop up. On top of that, two things will appear on your R package folder:

  • /docs: The function pkgdown::build_site() transformed all the R markdown files from your package’s /vignettes folder into HTML documents (HTML is another programming language, just like R, in which most websites are written). All these HTML documents are stored in the \docs folder. My advice: best not to touch it unless you know what you are doing!

  • _pkgdown.yml: This is an extremely important file since it will determine the structure of your website. As a reference for your future projects, I encourage you to check the _pkgodown.yml file for cataract which you can find in the GitHub repository at: https://github.com/ggcostoya/cataract/blob/master/_pkgdown.yml (Again, so cool to have open source code you can copy and/or get inspired from right?).