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

09

Command line

1 / 8

Command line

1

2 / 8

Rendering

So far we've used the RStudio button to 🧶

What about on the command line?

3 / 8

Rendering

So far we've used the RStudio button to 🧶

What about on the command line?

rmarkdown::render("01-bakeoff-report.Rmd")
3 / 8

Your turn

Instead of using the "Knit" button, try running this code in your R console:

library(rmarkdown) # needs to be loaded first
render("01-bakeoff-report.Rmd")
# or
rmarkdown::render("01-bakeoff-report.Rmd")

Now try changing the parameters:

render("01-bakeoff-report.Rmd",
params = list(series = "9"))

If this was easy, play with the other parameters too. Or see if you can change the output format, and add output option toc = TRUE.

psst...answers on the next slide...

05:00
4 / 8

The rendered document doesn't appear in a pop up and you will have to click on the newly created 01-bakeoff-report.html which corresponds to the .rmd file.

A hint for finding the parameters to a function is to select F1 when the cursor is in the word render.

The help files will appear in the bottom right panel of RStudio.

Example answer

render("01-bakeoff-report.Rmd",
params = list(series = "9"),
output_format = "word_document")
5 / 8

Take-aways

6 / 8

Take-aways

✔️ Documents run sequentially the order of your code chunks matters

6 / 8

Take-aways

✔️ Documents run sequentially the order of your code chunks matters

✔️ Click or code the flexibility of RMarkdown is that you can use RStudio or code in the console

6 / 8

Take-aways

✔️ Documents run sequentially the order of your code chunks matters

✔️ Click or code the flexibility of RMarkdown is that you can use RStudio or code in the console

RMarkdowns are self-contained any data use needs to be coded in the script and not "pre-loaded" in RStudio

6 / 8

Take-aways

✔️ Documents run sequentially the order of your code chunks matters

✔️ Click or code the flexibility of RMarkdown is that you can use RStudio or code in the console

RMarkdowns are self-contained any data use needs to be coded in the script and not "pre-loaded" in RStudio

Manual parameters overwrite the output each output needs to be saved individually - this can be laborious

6 / 8

Time for a break!

10:00
7 / 8

Next section...

8 / 8

Command line

1

2 / 8
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