+ - 0:00:00
Notes for current slide
Notes for next slide

Goals for today's session

  • Obvious ones:

    • Learn about RMarkdown
    • Know how to write your thesis in RMarkdown
  • Less obvious ones:

    • Know about the magic of knitr (support for other formats and other programming languages)
    • Learn how to get the best of all worlds (python, R, whatever other language)


Bonus: Ready to use template from us!

2 / 23

Why not just use Word?

Ever found yourself doing this every time you update your code?


3 / 23

Why not just use Word?

When using word, you're decoupling the coding and writing parts of your thesis:

4 / 23

Why not just use Word?

With RMarkdown, you're coding and writing in the same place.


5 / 23

Benefits of RMD over Word

You should use RMD, if

  • you want to show output from code in your thesis
  • you want the practical and aesthetic benefits of LaTeX

Benefits

  • no more CTRL-C and CTRL-V to reflect changes
  • LaTeX is much less administrative effort for formatting/alignment in larger projects like a thesis
6 / 23

Benefits of RMD over Word

The work process in Word (for every individual chart):

Change Chart in R -> Write to .png -> Copy into Word -> Align

If you realise you made a mistake in your early data preprocessing, you'll have to do it all over again for all charts every time!

7 / 23

Benefits of RMD over Word

The work process in Word (for every individual chart):

Change Chart in R -> Write to .png -> Copy into Word -> Align

If you realise you made a mistake in your early data preprocessing, you'll have to do it all over again for all charts every time!


Depiction of above process, 2022, colourised

7 / 23

Not in RMD!

Writing your code and text in the same place means: All changes are reflected immediately.

If you made an error in the data preprocessing, just correct the error. End of story. No modifications to the charts are necessary.

Why? Because the code is fully executed, all charts are aligned and formatted each time you knit the document.

The keyboard stays intact.

8 / 23

RMarkdown

video

9 / 23

Your turn

Open an RMarkdown file in RStudio:

File -> New File -> RMarkdown -> Give it a title -> Choose output format PDF

Save this document somewhere you'll find it again.

You need a LaTeX distribution to make it work. Luckily, R makes it easy for us. Run the following in your console:

install.packages("tinytex")
tinytex::install_tinytex()

Then, let's inspect what we're looking at.

10 / 23

How do you write your thesis with this?

A program for your thesis needs to fulfil the following points:

  • Title page
  • Table of contents
  • Table of figures
  • Page numbering
  • Citations
  • References
  • ...

RMarkdown does all of this, because you can use raw LaTeX. This is where the magic happens: You can combine your code and the power of LaTeX to generate research papers.

11 / 23

A disclaimer

12 / 23

Fear not. We got you covered with a template:

13 / 23

Fear not. We got you covered with a template:

Saves you from this:



13 / 23

Let's take a look

Download the template from the resources section on our website and extract the main folder from the ZIP folder.

14 / 23

The Parent Document

Open FirstName-LastName-12345678.pdf. Let's take a look together

15 / 23

The Parent Document

Open FirstName-LastName-12345678.rmd. Let's take a look together


16 / 23

The Parent Document

Let's knit it once. Doing this the first time, the LaTeX distribution first installs the necessary packages from the YAML, this takes a few minutes. The next knit will take much less time.

17 / 23

The Children

18 / 23

The Children

The following chunk in the parent document "pulls in" the information in the child document. Hence, the parent functions as the global hub for knitting, also setting all formatting and applying it equally to all children.


```{r intro, child = 'introduction.rmd'}
```


Always knit from the parent document. This takes a little getting used to, but you'll get around to it.

19 / 23

Basic tools

Open introduction.rmd and keep the PDF open. Let's take a look at this together.


20 / 23

So let's recap

We wanted:

  • Title page
  • Table of contents
  • Table of figures
  • Page numbering
  • Citations
  • References
  • ...

And most importantly: No more manual copying and pasting.

21 / 23

That's it for today!

We hope this tutorial was useful! Feel free to make use of the template and don't despair if you encounter errors. For further questions, feel free to reach out to us. Make sure to stay updated on our socials and via our website where all resources and dates are also published.


22 / 23

Goals for today's session

  • Obvious ones:

    • Learn about RMarkdown
    • Know how to write your thesis in RMarkdown
  • Less obvious ones:

    • Know about the magic of knitr (support for other formats and other programming languages)
    • Learn how to get the best of all worlds (python, R, whatever other language)


Bonus: Ready to use template from us!

2 / 23
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow