class: title-slide, middle # Touchdown your research with <img src="assets/img/rmarkdown.png" style="vertical-align: middle;margin:10px" width="120px"></img> .instructors[ **QCBS R Workshop** Steve Vissault, Marie-Hélène Brice, David Beauchesne & Kevin Cazelles ] <a href="https://insileco.github.io"><img src="assets/img/inSileco.png" width="80px"></img></a> <div style="color:white;"> .font60[Adapted from [Alison Hill](https://rmd4medicine.netlify.com/slides/01-rmd-anatomy.html#8)] </div> --- # Workshop setup - Make sure you have an updated version of [RStudio](https://rstudio.com/products/rstudio/download/) - Install the [code version-control system Git](https://git-scm.com/downloads) - Create a [Github account](https://github.com/join?source=header-home) - Run the following R command: ```r install.packages(c("rmarkdown", "htmlwidgets", "bookdown", "blogdown", "DT", "leaflet", "rbokeh")) ``` - Be prepared to turn into a geek or just learn cool stuff --- class: clear, middle, center <img src="assets/img/rmarkdown_rockstar.png" width="80%" /> .font80[Illustration from [@allisonhorst](https://twitter.com/allison_horst)] --- class: clear, middle ## R Markdown universe R Markdown produces dynamic document in a variety of format. ### Opens new possibilities with R: * make CV, poster & online presentation * format scientific paper (`rticles`) * help to document your research through notebook (`bookdown`) * build an academic blog or website (`blogdown`) --- class: clear, middle ## But what's R Markdown? - ["An authoring framework for data science."](https://rmarkdown.rstudio.com/lesson-1.html) (✔️) - [A document format (.Rmd).](https://bookdown.org/yihui/rmarkdown/) (✔️) - [An R package named rmarkdown.](https://rmarkdown.rstudio.com/docs/) (✔️) - ["A tool for integrating text, code, and results."](https://r4ds.had.co.nz/communicate-intro.html) (✔️) - ["A file format for making dynamic documents with R."](https://rmarkdown.rstudio.com/articles_intro.html) (✔️) - ["A computational document."](http://radar.oreilly.com/2011/07/wolframs-computational-documen.html) (✔️) - [Wizardry.](https://raw.githubusercontent.com/allisonhorst/stats-illustrations/master/rstats-artwork/rmarkdown_wizards.png) (🧙) --- class: inverse, center, middle # Workshop objective <html><div style='float:left'></div><hr color='#ffdd55' style="margin-top:-60px" size=1px width=720px></html> ## Build a website | notebook | presentation with <code style="color:rgb(11, 43, 70)">rmarkdown</code> and deploys it on the web --- class: inverse, center, middle # Basic Anatomy <html><div style='float:left'></div><hr color='#ffdd55' style="margin-top: -60px;" size=1px width=720px></html> ## R Markdown (
+
) --- #
Exercice 1. Open RStudio 2. File > New File > R Markdown 3. Fill the fields *author* and *title* 4. Set default output format to HTML 5. Look at the source, then 🧶 Knit to HTML. ### Try to identify these parts in the source and the output: - The metadata - The text
- The code
- The output
03
:
00
--- # How does R Markdown work? .pull-left[ <img src="assets/img/Rmdformat.png" width="100%" /> ] .pull-right[ - 🤷 - I press knit, a document appears, and I believe that anything happening in between could be actual magic. - `knitr` executes the code and converts `.Rmd` to `.md`; Pandoc renders the `.md` file to the output format you want. ] --- class: middle, center, clear ![](https://raw.githubusercontent.com/allisonhorst/stats-illustrations/master/rstats-artwork/rmarkdown_wizards.png) .font80[Illustration from [@allisonhorst](https://twitter.com/allison_horst)] --- class: inverse, center, middle # Document metadata <html><div style='float:left'></div><hr color='#ffdd55' style="margin-top: -60px;" size=1px width=720px></html> ## R Markdown (
+
) --- # Metadata and options Metadata with options are defined in the header of the `.Rmd` document as a set of `key` and `value` (YAML syntax). .pull-left[ ### One output ```r --- output: html_document --- ``` ] .pull-right[ ### Two outputs ```r --- output: html_document: toc: true pdf_document: toc: false --- ``` ] Options available depend on the output. See `?html_document `, `?pdf_document`, `?word_document` ??? - You have already notice the keys `author`, `title`, `date` - What's the purpose of the indentation? --- #
Exercice ### Edit the output options Use `?html_document` from your R console to: 1. Add a floating table of contents 2. Add a theme 3. Use the "kable" method to print data frames 🧶 Knit to HTML to see the output. If this was easy, try to embed the Rmd source code to download.
03
:
00
??? ### Answer ```r --- output: html_document: toc: true toc_float: true theme: flatly df_print: kable code_download: true --- We have done a brief overview of the document options (the shape), we now make an introduction of the content ``` --- class: inverse, center, middle # Document content <html><div style='float:left'></div><hr color='#ffdd55' style="margin-top: -60px;" size=1px width=720px></html> ## R Markdown (
+
) --- class: clear, middle, center <img src="assets/img/rmarkdown_rockstar.png" width="80%" /> .font80[Illustration from [@allisonhorst](https://twitter.com/allison_horst)] --- class: inverse, center, middle # Text formatting <html><div style='float:left'></div><hr color='#ffdd55' style="margin-top: -60px;" size=1px width=720px></html> ## Markdown
--- # Text style .pull-left[ ````md # Header 1 ## Header 2 ### Header 3 #### Header 4 *italic* or _italic_ **bold** `code` ```r library(tibble) data(iris) glimpse(as_tibble(iris)) ``` ```` ] .pull-right[ <h1 style="margin:0px;padding:0px">Header 1</h1> <h2 style="margin:0px;padding:0px">Header 2</h2> <h3 style="margin:0px;padding:0px">Header 3</h3> <h4 style="margin:0px;padding:0px">Header 4</h4> *italic* or _italic_ **bold** `code` ```r library(tibble) data(iris) glimpse(as_tibble(iris)) ``` ] ??? Headers help you to structure your Rmd Document --- # Lists .pull-left[ ```md Lorem ipsum dolor sit amet, consectetur adipiscing elit. - Cras convallis purus. - Nunc faucibus. - Maecenas ipsum dolor. Nulla vehicula metus vel tortor venenatis luctus. Etiam tempus sit amet ligula nec pretium. Aenean ultrices massa sed pulvinar pulvinar. 1. Duis aliquam commodo volutpat. 1. Mauris ultrices. 1. Aliquam eu erat. ``` ] .pull-right[ Lorem ipsum dolor sit amet, consectetur adipiscing elit. * Cras convallis purus. - Nunc faucibus. * Maecenas ipsum dolor. Nulla vehicula metus vel tortor venenatis luctus. 1. Duis aliquam commodo volutpat. 1. Mauris ultrices. 1. Aliquam eu erat. ] --- # Images .pull-left[ ```md ![Hulk vs Trump](https://media.giphy.com/media/MkGyW2cOH7uhO/giphy.gif) ``` ] .pull-right[ ![Hulk vs Trump](https://media.giphy.com/media/MkGyW2cOH7uhO/giphy.gif) ] --- # Links .pull-left[ ```md [Hulk vs Trump](https://media.giphy.com/media/MkGyW2cOH7uhO/giphy.gif) ![Hulk vs Trump](https://media.giphy.com/media/MkGyW2cOH7uhO/giphy.gif) ``` ] .pull-right[ [Hulk vs Trump](https://media.giphy.com/media/MkGyW2cOH7uhO/giphy.gif) ![Hulk vs Trump](https://media.giphy.com/media/MkGyW2cOH7uhO/giphy.gif) ] --- # Tables .pull-left[ ### Syntax ```md | Time | Session | Topic | |:--------------|:-------:|---------:| | _left_ | _center_| _right_ | | 01:00 - 01:50 | 1 | Anatomy | | 01:50 - 02:00 | | *Break* | | 02:00 - 02:45 | 2 | Tables | | 02:45 - 03:00 | | *Break* | ``` ] .pull-right[ ### Output | Time | Session | Topic | |:--------------|:-------:|---------:| | _left_ | _center_| _right_ | | 01:00 - 01:50 | 1 | Anatomy | | 01:50 - 02:00 | | *Break* | | 02:00 - 02:45 | 2 | Tables | | 02:45 - 03:00 | | *Break* | ] -
the `:` specify the alignement. - Not convenient for long table, we will use instead
to print the markdown table for us. --- class: inverse, center, middle # Code chunks <html><div style='float:left'></div><hr color='#ffdd55'style="margin-top: -60px;" size=1px width=720px></html> ## The
part --- # Chunks ````md This text is written in markdown ```{r} library(tibble) data(iris) head(iris) ``` ```` -
`r` between brackets `{}`, why is that? - Where is the
code and the
section? --- # Chunks ### Code ```r library(tibble) data(iris) head(iris) ``` ### Print output ``` ## Sepal.Length Sepal.Width Petal.Length Petal.Width Species ## 1 5.1 3.5 1.4 0.2 setosa ## 2 4.9 3.0 1.4 0.2 setosa ## 3 4.7 3.2 1.3 0.2 setosa ## 4 4.6 3.1 1.5 0.2 setosa ## 5 5.0 3.6 1.4 0.2 setosa ## 6 5.4 3.9 1.7 0.4 setosa ``` --- # Chunks .pull-left[ ### Code ```r library(ggplot2) data(iris) ggplot( data=iris, aes(x = Sepal.Length, y = Sepal.Width) ) + geom_point( aes(color=Species, shape=Species) ) + xlab("Sepal Length") + ylab("Sepal Width") + ggtitle("Sepal Length-Width") ``` ] .pull-right[ ### Graphic output ![](index_files/figure-html/unnamed-chunk-11-1.png)<!-- --> ] --- # Chunks .pull-left[ ### Code ```r library(leaflet) leaflet(height=400, width=400) %>% addTiles() %>% addMarkers(lng=174.768, lat=-36.852, popup="The birthplace of R") ``` ] .pull-right[ <h3 style="margin-bottom:10px;">Map</h3>
] --- # Chunks .pull-left[ ### Code ```r library(rbokeh) p <- figure() %>% ly_points(Sepal.Length, Sepal.Width, data = iris, color = Species, glyph = Species, hover = list(Sepal.Length, Sepal.Width)) p ``` ] .pull-right[ <h3 style="margin-bottom:10px;">Map</h3>
] --- # Inline chunks ###
Syntax We studied `` `r length(levels(iris$Species))` `` iris species and took measurements on `` `r nrow(iris)` `` flowers. We found that Iris virginica had the longest sepal with a mean of `` `r mean(subset(iris,Species=="virginica")$Sepal.Length)` `` millimeters! ###
Output ````md This text is written in markdown. We studied 3 iris species and took measurements on 150 flowers. We found that Iris virginica had the longest sepal with a mean of 6.588 millimeters! ```` --- class: inverse, center, middle #
Chunks options <html><div style='float:left'></div><hr color='#ffdd55' style="margin-top: -60px;" size=1px width=720px></html> --- # Chunks options .pull-left[ - Place between curly braces `{r option=value}` - Multiple options separated by commas `{r option1=value, option2=value}` - Label your code chunk! <img height="160px" width="160px" src="https://d33wubrfki0l68.cloudfront.net/6fcddff214345601f998805adce94ab0e21d8615/2a098/screenshots/rmarkdown-chunk-nav.png"></img> ] .pull-right[ ````md ```{r dispIris, option1=value, option2=value} library(tibble) data(iris) head(iris) ``` ```` ] --- # Chunk options Chunk output can be customised with [numerous options](https://yihui.name/knitr/options/): ```r str(knitr::opts_chunk$get()) ``` ``` ## List of 53 ## $ eval : logi TRUE ## $ echo : logi TRUE ## $ results : chr "markup" ## $ tidy : logi FALSE ## $ tidy.opts : NULL ## $ collapse : logi FALSE ## $ prompt : logi FALSE ## $ comment : chr "##" ## $ highlight : logi TRUE ## $ strip.white : logi TRUE ## $ size : chr "normalsize" ## $ background : chr "#F7F7F7" ## $ cache : logi FALSE ## $ cache.path : chr "index_cache/html/" ## $ cache.vars : NULL ## $ cache.lazy : logi TRUE ## $ dependson : NULL ## $ autodep : logi FALSE ## $ cache.rebuild: logi FALSE ## $ fig.keep : chr "high" ## $ fig.show : chr "asis" ## $ fig.align : chr "default" ## $ fig.path : chr "index_files/figure-html/" ## $ dev : chr "png" ## $ dev.args : NULL ## $ dpi : num 72 ## $ fig.ext : NULL ## $ fig.width : num 7 ## $ fig.height : num 7 ## $ fig.env : chr "figure" ## $ fig.cap : NULL ## $ fig.scap : NULL ## $ fig.lp : chr "fig:" ## $ fig.subcap : NULL ## $ fig.pos : chr "" ## $ out.width : NULL ## $ out.height : NULL ## $ out.extra : NULL ## $ fig.retina : num 1 ## $ external : logi TRUE ## $ sanitize : logi FALSE ## $ interval : num 1 ## $ aniopts : chr "controls,loop" ## $ warning : logi TRUE ## $ error : logi FALSE ## $ message : logi TRUE ## $ render : NULL ## $ ref.label : NULL ## $ child : NULL ## $ engine : chr "R" ## $ split : logi FALSE ## $ include : logi TRUE ## $ purl : logi TRUE ``` --- # Default options .pull-left[ ###
Syntax ````md ```{r} head(iris) ``` ```` ] .pull-right[ ###
Output ```r head(iris) ``` ``` ## Sepal.Length Sepal.Width Petal.Length Petal.Width Species ## 1 5.1 3.5 1.4 0.2 setosa ## 2 4.9 3.0 1.4 0.2 setosa ## 3 4.7 3.2 1.3 0.2 setosa ## 4 4.6 3.1 1.5 0.2 setosa ## 5 5.0 3.6 1.4 0.2 setosa ## 6 5.4 3.9 1.7 0.4 setosa ``` ] --- # Chunk option `echo` .pull-left[ ###
Syntax ````md ```{r echo = FALSE} head(iris) ``` ```` ] .pull-right[ ###
Output ``` ## Sepal.Length Sepal.Width Petal.Length Petal.Width Species ## 1 5.1 3.5 1.4 0.2 setosa ## 2 4.9 3.0 1.4 0.2 setosa ## 3 4.7 3.2 1.3 0.2 setosa ## 4 4.6 3.1 1.5 0.2 setosa ## 5 5.0 3.6 1.4 0.2 setosa ## 6 5.4 3.9 1.7 0.4 setosa ``` ] - Display results but not code. - Useful to present results to people not interested by the code. - Use `echo = -1` to hide only the first line of a code chunk. --- # Chunk option `eval` .pull-left[ ###
Syntax ````md ```{r eval = FALSE} head(iris) ``` ```` ] .pull-right[ ###
Output ```r head(iris) ``` ] - Code is not evaluated. - Useful to show exemple code. - Use `eval = -1` to evaluate every line of a code chunk except the first. --- # Chunk option `include` .pull-left[ ###
Syntax ````md ```{r include = FALSE} head(iris) ``` ```` ] .pull-right[ ###
Output ] - Code is evaluated but no output (code, results and figures) is displayed. - Useful in setup options and package installation. --- # Chunk option `results` .pull-left[ ###
Syntax ````md ```{r results = "hold"} 1 + 1 2 + 2 ``` ```` ] .pull-right[ ###
Output ```r 1 + 1 2 + 2 ``` ``` ## [1] 2 ## [1] 4 ``` ] - Hold all results in a code chunk and display them at the end. --- # Chunk option `results` .pull-left[ ###
Syntax ````md ```{r results = "hide"} 1 + 1 ggplot(data = iris, aes(x = Petal.Length, y = Petal.Width)) + geom_point() ``` ```` - Hide results but not plots ] .pull-right[ ###
Output ```r 1 + 1 ggplot(data = iris, aes(x = Petal.Length, y = Petal.Width)) + geom_point() ``` <img src="index_files/figure-html/unnamed-chunk-23-1.png" width="288" style="display: block; margin: auto;" /> ] --- # Chunk options `fig.height` & `fig.width` .pull-left[ ###
Syntax ````md ```{r fig.height = 3, fig.width = 5, echo = FALSE} ggplot(data = iris, aes( x = Sepal.Length, y = Sepal.Width, color = Species)) + geom_point() ``` ```` ] .pull-right[ ###
Output ![](index_files/figure-html/unnamed-chunk-24-1.png)<!-- --> ] - width and height of the plot in inches - Note that options are separated by commas --- # Chunk options ### What output each option suppresses? Option | Run code | Show code | Output | Plots | Messages | Warnings -------------------|:--------:|:---------:|:------:|:-----:|:--------:|:-------: `eval = FALSE` |
| |
|
|
|
`include = FALSE` | |
|
|
|
|
`echo = FALSE` | |
| | | | `results = "hide"` | | |
| | | `fig.show = "hide"`| | | |
| | `message = FALSE` | | | | |
| `warning = FALSE` | | | | | |
Table from [R for Data Science](https://r4ds.had.co.nz/r-markdown.html#chunk-options) --- # Global chunk options ## Setup You can change the default chunk options for all following chunks in your document. ````md ```{r include = FALSE} knitr::opts_chunk$set( collapse = TRUE, cache = TRUE, comment = "#>", fig.width = 6, fig.align = "center" ) ``` ```` --- #
Exercice ## Let's practice ! 1. Open a new `.Rmd` document and run `data(diamonds)` within a chunk 2. Add the following text and fill it: ` We have data about XXXX diamonds. Only XXXX are larger than 2.5 carats. ` 3. Display all diamonds larger than 2.5 carats with the function `DT::datatable()`. 4. Make an histogram of the carats. The figure should have an height and width of 4 inches. 5. `DT::datatable()` doesn't work with PDF or Word document, why?
10
:
00
--- # Wrapping up ✔️ **Document your document**: use YAML to set up meaningful metadata ✔️ **Style your document**: use YAML to add options to your chosen output format ✔️ **Organize your text**: use markdown headers with `#` ✔️ **Organize your code**: use `knitr` chunk labels ✔️ **Style your text**: use markdown **bold**, *italics*, <i class="fas fa-list-ul"></i> bullets, and <i class="fas fa-list-ol"></i> lists ✔️ **Style your output**: use `knitr` chunk options 🧶 early, 🧶 often --- # Why using it?
Multiplateform | Portable | Reproducible <img src="assets/img/rmarkdownflow.png" width="100%" /> --
Impress your director with dynamic output | Turn into a geek | Expose your skills on the web --- class: inverse, center, middle #
Launch document on the web <html><div style='float:left'></div><hr color='#ffdd55' style="margin-top: -60px;" size=1px width=720px></html> --- #
Launch document on the web ## Mission Send an HTML output on Github <img src="assets/img/rmarkdownflow_withSel_github.png" width="100%" /> --- #
Launch document on the web ### 5 steps 1. Open new GitHub repository and activate Github page 2. Link this new repo to a RStudio project 3. Add a `.Rmd` document and generate the HTML document (we know that part!) 4. Declare (`add`) and document (`commit`) the modifications on the repository 5. Send these modifications with the HTML output on Github via RStudio -- ### Let's do it together! --- #
Launch document on the web ### 1a. Open a new GitHub repository <img src="assets/img/createRepo.png" width="100%" /> -- - Name it as `firstOnlineDocument` - Let's make the repository public --- #
Launch document on the web ### 1b. Activate Github page <img src="assets/img/config.png" width="100%" /> --- #
Launch document on the web ### 1b. Activate Github page <img src="assets/img/gh-pages.png" width="100%" /> --- #
Launch document on the web ### 1b. Activate Github page Several options <img src="assets/img/gh-pages_options.png" width="100%" /> --- #
Launch document on the web ### 2. Link this new repo to a RStudio project In RStudio: file > new project... > Version control > Git <img src="assets/img/createProject.png" width="40%" style="display: block; margin: auto;" /> - Fill the field `Repository URL` with the URL address of your repo **and add `.git` at the end** - Exemple: `https://github.com/SteveViss/firstOnlineDocument.git` --- #
Launch document on the web ### 3. Add a `.Rmd` document and generate the HTML document - You know that part, so let's do it. - We want to create a `.Rmd` and produces a `.html` file in the RStudio project folder. -
with the following filenames: `index.html` & `index.Rmd` - Make sure you save the files within the project folder
05
:
00
--- #
Launch document on the web ### 4. Declare (`add`) and document (`commit`) the modifications on the repository <img src="assets/img/git1.png" width="100%" style="display: block; margin: auto;" /> --- #
Launch document on the web ### 4. Declare (`add`) and document (`commit`) the modifications on the repository <img src="assets/img/git2.png" width="6936" height="80%" style="display: block; margin: auto;" /> --- #
Launch document on the web ### 5. Last step, send these modifications on the Github repo via RStudio <img src="assets/img/git3.png" width="6936" height="80%" style="display: block; margin: auto;" /> --- #
Launch document on the web Wait few minutes and see the result at [https://YOURUSERNAME.github.io/firstOnlineDocument/](https://YOURUSERNAME.github.io/firstOnlineDocument/) <img src="assets/img/ironcat.jpg" width="35%" style="display: block; margin: auto;" /> --- #
The `down` universe - Write a notebook: `bookdown` - Write a thesis: `thesisdown` - Write a scientific article `rticles` - Create a poster: `posterdown` - Create nice presentation: `xaringan` or `rmarkdown` - Build a CV: `vitae` - Generate a blog: `blogdown` - Generate R package documentation: `pkgdown` --- class: inverse, center, middle #
Building a presentation <html><div style='float:left'></div><hr color='#ffdd55' style="margin-top: -60px;" size=1px width=720px></html> --- # Motivation 1. Create a presentation
2. Use Markdown to quickly format your content 3. Insert code examples
4. Insert your R figures
--- # Create a Rmarkdown presentation ## Templates in R Studio - [ioslides](https://bookdown.org/yihui/rmarkdown/ioslides-presentation.html) - [slidy](https://bookdown.org/yihui/rmarkdown/slidy-presentation.html) - also "r presentations" but it uses a different markdown syntax so we won't present it here <img src="assets/img/ioslides1.png" width="49%" /><img src="assets/img/ioslides2.png" width="49%" /> --- # Create a Rmarkdown presentation in R Studio .center[ ![:scale 90%](assets/img/create_rmd_pres1.png) ] --- # Create a Rmarkdown presentation in R Studio .center[ ![:scale 90%](assets/img/create_rmd_pres2.png) ] --- # ioslides Specify the `ioslides_presentation` output format in the YAML metadata of your document ```md --- title: "My beautiful ioslide presentation" author: "John Doe" date: '2019-10-02' output: ioslides_presentation --- ``` --- # ioslides Knit 🧶 to create the HTML presentation! .center[![:scale 90%](assets/img/ioslides_knit.png)] --- # ioslides Create new slides by using `#` or `##` ```md # Section slides | super stuff ``` .center[![:scale 70%](assets/img/ioslides_section.png)] --- # ioslides Create new slides by using `#` or `##` ```md # Section slide | with background image {data-background=bg_mountain.jpg data-background-size=cover} ``` .center[ ![:scale 70%](assets/img/ioslides_bg.png) ] --- # ioslides Create new slides by using `#` or `##` ```md ## Slides with content - I love science - and **kitten!** ![](kitten.jpg){ width=60% } ``` .center[![:scale 70%](assets/img/ioslides_content.png)] --- # ioslides -
code ````md ## Slide with R code ```{r, echo = TRUE} fit <- lm(dist ~ 1 + speed, data = cars) coef(summary(fit)) ``` ```` .center[![:scale 60%](assets/img/ioslides_rcode.png)] --- # ioslides -
plot ````md ## Slide with R plot ```{r, echo = TRUE} plot(dist ~ speed, data = cars) ``` ```` .center[ ![:scale 60%](assets/img/ioslides_rplot.png) ] --- # ioslides - options ```md --- title: "My beautiful ioslide presentation" author: "John Doe" date: '2019-10-02' output: ioslides_presentation: logo: insilecoLogo.png --- ``` .center[ ![:scale 60%](assets/img/ioslides_logo.png) ] --- # ioslides - options ### Customize - presentation size using `widesreen` - speed of slide transitions using `transition` - incremental bullets using `incremental` - text size using `smaller` ```md --- title: "My beautiful ioslide presentation" author: "John Doe" date: '2019-10-02' output: ioslides_presentation: widescreen: true transition: slower incremental: true smaller: true --- ``` --- # ioslides - Customization You can customize your presentation by adding your own CSS and your own template ```md --- title: "My beautiful ioslide presentation" author: "John Doe" date: '2019-10-02' output: ioslides_presentation: css: mystyles.css template: mytemplate.html --- ``` --- # Slidy To create a [Slidy](https://bookdown.org/yihui/rmarkdown/slidy-presentation.html) presentation in R studio .center[ ![:scale 80%](assets/img/create_slidy.png) ] --- # Slidy - You can transform your ioslides presentation to a slidy presentation by changing the output format to `slidy_presentation` in the YAML - Usage of slidy is similar to ioslides, but see details [here](https://bookdown.org/yihui/rmarkdown/slidy-presentation.html) ```md --- title: "My beautiful slidy presentation" author: "John Doe" date: '2019-10-02' output: slidy_presentation --- ``` .center[ ![:scale 40%](assets/img/slidy1.png) ] --- # PowerPoint - You can also generate a [PowerPoint](https://bookdown.org/yihui/rmarkdown/powerpoint-presentation.html) presentation using R! ```md --- title: "My beautiful PPT presentation" author: "John Doe" date: '2019-10-02' output: powerpoint_presentation --- ``` --- # Xaringan - It is also possible to install R packages to create presentation - ex: xaringan, see [here](https://slides.yihui.name/xaringan/#1) and [here](https://bookdown.org/yihui/rmarkdown/xaringan.html) ```r install.packages("xaringan") ``` ```md --- title: "My beautiful Xaringan presentation" subtitle: "Symposium" author: "John Doe" output: xaringan::moon_reader: --- # Slide 1 wow! --- # Slide 2 The end! ``` --- # Xaringan - QCBS R workshop presentations are built using xaringan! .center[ [![:scale 70%](assets/img/r_workshops.png)](https://qcbsrworkshops.github.io/workshop01/workshop01-en/workshop01-en.html#1) ] --- # Resources 1. [R Markdown: The Definitive Guide - Chapter 4](https://bookdown.org/yihui/rmarkdown/presentations.html) 2. [ioslides](https://kevcaz.github.io/pres_Rmarkdown_fr/#1) 3. [xaringan](https://slides.yihui.name/xaringan/#1) --- class: inverse, center, middle #
Create a notebook <html><div style='float:left'></div><hr color='#ffdd55' style="margin-top: -60px;" size=1px width=720px></html> --- # Motivation .pull-left[ - Producing more complicated documents - Automatic number and cross-referencing - Figures - Tables - Equations - Theorems - Custom headers - Figure formatting and placement - Customized visuals ] .pull-right[ <img src="https://bookdown.org/yihui/bookdown/images/logo.png" width="35%" style="display: block; margin: auto;" /> ] --- # With Rstudio project <img src="assets/img/bookdown_project.png" width="3729" height="60%" style="display: block; margin: auto;" /> --- # Bookdown - Examples - Minimal: https://bookdown.org/yihui/bookdown-demo/ <iframe width="100%" height="80%" src="https://bookdown.org/yihui/bookdown-demo/"> </iframe> --- # Bookdown - Examples - Tufte style: https://bookdown.org/yihui/bookdown-demo3/ <iframe width="100%" height="80%" src="https://bookdown.org/yihui/bookdown-demo3/"> </iframe> --- # Bookdown - Usage - Collection of `.Rmd` files - Individual chapter for each file - Chapter title defined by first-level heading `#` - Usual Rmarkdown syntax - Rendered by filename order by default .pull-left[ - `01-Introduction.Rmd` <br><br><br> - `02-Chapter1.Rmd` <br><br><br> - `03-Conclusion.Rmd` ] .pull-right[ ```r # Introduction This is the introduction ``` ```r # Chapter 1 This is the Chapter 1 ``` ```r # Conclusion This is the conclusion ``` ] --- # Bookdown - Usage - Outputs options - `HTML` - `pdf` - `E-Books` --- # Bookdown - Getting started <iframe width="100%" height="90%" src="https://bookdown.org/yihui/bookdown/get-started.html"> </iframe> --- # Bookdown - Resources - Github repository: https://github.com/rstudio/bookdown - Bookdown book: https://bookdown.org/yihui/bookdown/ --- #
The `down` universe - Write a notebook: `bookdown` - Write a thesis: `thesisdown` - Write a scientific article `rticles` - Create a poster: `posterdown` - Create nice presentation: `xaringan` or `rmarkdown` - Build a CV: `vitae` - Generate a blog: `blogdown` - Generate R package documentation: `pkgdown`