class: title-slide, center, middle <span class="fa-stack fa-4x"> <i class="fa fa-circle fa-stack-2x" style="color: #ffffffcc;"></i> <strong class="fa-stack-1x" style="color:#e7553c;">09</strong> </span> # Command line --- class: inverse, center, middle # <center>Command line</center> <span class="fa-stack fa-4x"> <i class="fa fa-circle fa-stack-2x" style="color: #fff;"></i> <strong class="fa-stack-1x" style="color:#17a2b8;">1 </strong> </span> --- class: middle, center # Rendering .pull-left[ So far we've used the RStudio button to 🧶 What about on the command line? ] -- .pull-right[ ```r rmarkdown::render("01-bakeoff-report.Rmd") ``` ] --- class: your-turn # Your turn Instead of using the "Knit" button, try running this code in your R console: ```r library(rmarkdown) # needs to be loaded first render("01-bakeoff-report.Rmd") # or rmarkdown::render("01-bakeoff-report.Rmd") ``` Now try changing the parameters: ```r 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
??? 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. --- class: your-turn # Example answer ```r render("01-bakeoff-report.Rmd", params = list(series = "9"), output_format = "word_document") ``` --- class: middle, center # 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 --- class: middle, center # ⏱ # Time for a break!
10
:
00
--- class: inverse # <center>Next section...</center>