background-image: url(images/bg1.jpg) background-size: cover class: hide-slide-number title-slide :::::::::: { .grid grid: 50% 50% / 1fr;} ::: item center # <span style="text-shadow: 2px 2px 30px white;">R Markdown Workshop</span> <br><br> ## <span style="color:yellow;text-shadow: 2px 2px 30px black;">Pretty Presentations</span> ::: ::: center shade_black animated bounceInUp slower Presented by Emi Tanaka School of Mathematics and Statistics <img src="assets/USydLogo-white.svg" style="width:200px"><br>
<i class="fas fa-envelope faa-float animated "></i>
dr.emi.tanaka@gmail.com
<i class="fab fa-twitter faa-float animated faa-fast "></i>
@statsgen .bottom_abs.width100.bg-black[ 19th Nov 2019 @ SSA Vic | Melbourne, Australia ] ::: :::::::::: ::: { .shade_black .pos .font_small width:20%;right:10px;bottom:20%;padding:5px;border: solid 5px white;} <i class="fas fa-exclamation-circle"></i> These slides are viewed best by Chrome and occasionally need to be refreshed if elements did not load properly. See here for <a href=session3.pdf style="color:white!important"/>PDF <i class="fas fa-file-pdf"></i></a>. ::: --- # HTML Slides from Rmd ::: grid ::: item * There are a number of ways to make html slides in Rmd including `ioslides` and `slidy`. * My favorite one is `xaringan` 📦! * It's highly customisable. * These slides are made by `xaringan`! * `xaringan` uses `remark.js` to render the final html instead of `pandoc` (which means some `pandoc` features don't work) :::: ::: item <iframe src="https://slides.yihui.name/xaringan/" height = "450px" width = "600px"></iframe> https://slides.yihui.name/xaringan ::: ::: --- class: center middle .font_large[🔍 Open and inspect the file] .font_large[`first-xaringan.Rmd`] --- class: font_smaller # `xaringan` slides ::: grid ::: item ```markdown --- title: "My first xaringan slide" subtitle: "Not!" author: "Emi Tanaka" date: "4th October 2019" output: xaringan::moon_reader --- # Slide after title slide *--- # Next slide We can use **markdown**! *--- ``` ::: ::: item <iframe src="exercises/first-xaringan.html" height = "450px" width = "600px"></iframe> ::: ::: ::: { .info-box .pos width:200px;left:31%;top:35%;} YAML information used for title slide ::: ::: { .info-box .pos width:250px;left:31%;bottom:11%;} No spaces after `---`! ::: --- class: middle center To fully customise `xaringan` slides, <br>you need to know some HTML/CSS -- <br> We'll have a short intro 💻 --- # HTML/CSS <br> ::: grid ::: item .html-box[ ```html <div class="bg-red"> This creates a box with red background. </div> ``` ] ::: ::: item .css-box[ ```css .bg-red { background-color: red; } ``` ] ::: {.output background-color:red!important; } This creates a box with red background. ::: ::: ::: --- # HTML/CSS II But the box and text look too squished. I increase the padding here. <br> ::: grid ::: item .html-box[ ```html <div class="bg-red"> This creates a box with red background. </div> ``` ] ::: ::: item .css-box[ ```css .bg-red { background-color: red; * padding: 20px; } ``` ] ::: {.output background-color:red!important;padding:20px; } This creates a box with red background. ::: ::: ::: --- # HTML/CSS III But a white text suits better. ::: grid ::: item .html-box[ ```html <div class="bg-red"> This creates a box with red background. </div> ``` ] ::: ::: item .css-box[ ```css .bg-red { background-color: red; padding: 20px; * color: white; } ``` ] ::: {.output background-color:red!important;padding:20px; color: white; } This creates a box with red background. ::: ::: ::: --- # HTML/CSS IV In contrast to `div`, `span` is "inline". ::: grid ::: item .html-box[ ```html *<span class="bg-red"> This creates a box with red background. *</span> ``` ] ::: ::: item .css-box[ ```css .bg-red { background-color: red; padding: 20px; color: white; } ``` ] ::: { .output padding-bottom: 20px;} <span style="background-color:red!important;padding:20px; color: white;"> This creates a box with red background.</span> ::: ::: ::: --- # `remark.js`: div and span classes `remark.js` makes it easier to write `div` and `span` elements. ::: grid ::: { .item border-right: dashed 3px black; } Text in new line ```markdown .bg-red[ Some text ] ``` is converted to ```markdown <div class="bg-red"> Some text </div> ``` ::: ::: item Placing `[` `]` in the same line ```markdown .bg-red[Some text] ``` results in ```markdown <span class="bg-red"> Some text </span> ``` ::: ::: --- class: font_small # Specifying CSS ::: paddings You can specify the css file in the YAML: ``` output: xaringan::moon_reader: css: - "default" # in-built theme - "default_fonts" # in built theme - "custom.css" # your own ``` then define all custom classes in `custom.css`, e.g. ```css .bg-red { background-color: red; } ``` ::: --- # Apply class to the whole slide ::: paddings ```markdown # Slide 1 --- *class: bg-red # Slide 2 This slide will have a red background --- # Slide 3 ``` ::: --- class: middle center ::: paddings Alternatively, you can use `xaringanthemer` to customise the look of a `xaringan`. <br> .font_large[💻 Open and knit<br> `demo-xaringan.Rmd`] <br> .font_large[Customise the slide to your liking ✨ ] <br> By the way, can you figure out what `xaringan::inf_mr()` does? ::: --- # Resources ::: grid ::: { .item border-right: dashed 3px black; } * There are more features to R Markdown than can be taught in a 3 hour workshop. * Please do let SSA know if you would be interested in having certain types of workshop! * Thanks for coming! <br> ::: { .info-box .pos width: 500px;} All source files to this workshop <br>can be found at https://github.com/emitanaka/ssavic2019 ::: ::: ::: item ## Learn with the *community* * Your local R-Ladies Meetup: [Melbourne](https://www.meetup.com/en-AU/rladies-melbourne/), [Sydney](https://www.meetup.com/rladies-sydney/), [Canberra](https://www.meetup.com/rladies-canberra/), [Perth](https://www.meetup.com/en-AU/rladies-perth/), [Adelaide](https://www.meetup.com/en-AU/rladies-adelaide/), [Brisbane](https://www.meetup.com/en-AU/rladies-brisbane/) * [R4DS Community Slack](https://www.rfordatasci.com/) * [Twitter with hastag #rstats](https://twitter.com/search?q=%23rstats) * [RStudio Community](https://community.rstudio.com/) * [Stackoverflow](https://stackoverflow.com/questions/tagged/r) (I answer questions tagged with `xaringan` often) ::: ::: --- background-color: #e5e5e5 # Session Information :::: scroll-350 ```r devtools::session_info() ``` ``` ─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── setting value version R version 3.6.0 (2019-04-26) os macOS Mojave 10.14.6 system x86_64, darwin15.6.0 ui X11 language (EN) collate en_AU.UTF-8 ctype en_AU.UTF-8 tz Australia/Sydney date 2019-11-15 ─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── package * version date lib source anicon 0.1.0 2019-05-28 [1] Github (emitanaka/anicon@377aece) assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.0) backports 1.1.4 2019-04-10 [1] CRAN (R 3.6.0) broom 0.5.2 2019-04-07 [1] CRAN (R 3.6.0) callr 3.3.1 2019-07-18 [1] CRAN (R 3.6.0) cellranger 1.1.0 2016-07-27 [1] CRAN (R 3.6.0) cli 1.1.0 2019-03-19 [1] CRAN (R 3.6.0) colorspace 1.4-1 2019-03-18 [1] CRAN (R 3.6.0) crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.0) curl 4.2 2019-09-24 [1] CRAN (R 3.6.0) dadjoke 0.1.2 2019-07-07 [1] Github (jhollist/dadjoke@21ec24c) desc 1.2.0 2018-05-01 [1] CRAN (R 3.6.0) devtools 2.0.2 2019-04-08 [1] CRAN (R 3.6.0) digest 0.6.22 2019-10-21 [1] CRAN (R 3.6.0) dplyr * 0.8.3 2019-07-04 [1] CRAN (R 3.6.0) emo 0.0.0.9000 2019-06-03 [1] Github (hadley/emo@02a5206) evaluate 0.14 2019-05-28 [1] CRAN (R 3.6.0) forcats * 0.4.0 2019-02-17 [1] CRAN (R 3.6.0) fs 1.3.1 2019-05-06 [1] CRAN (R 3.6.0) generics 0.0.2 2018-11-29 [1] CRAN (R 3.6.0) ggplot2 * 3.2.1 2019-08-10 [1] CRAN (R 3.6.0) glue 1.3.1.9000 2019-10-24 [1] Github (tidyverse/glue@71eeddf) gtable 0.3.0 2019-03-25 [1] CRAN (R 3.6.0) haven 2.1.0 2019-02-19 [1] CRAN (R 3.6.0) hms 0.5.1 2019-08-23 [1] CRAN (R 3.6.0) htmltools 0.4.0 2019-10-04 [1] CRAN (R 3.6.0) httr 1.4.1 2019-08-05 [1] CRAN (R 3.6.0) icon 0.1.0 2019-05-28 [1] Github (ropenscilabs/icon@a510f88) jsonlite 1.6 2018-12-07 [1] CRAN (R 3.6.0) knitr 1.25 2019-09-18 [1] CRAN (R 3.6.0) lattice 0.20-38 2018-11-04 [1] CRAN (R 3.6.0) lazyeval 0.2.2 2019-03-15 [1] CRAN (R 3.6.0) lifecycle 0.1.0 2019-08-01 [1] CRAN (R 3.6.0) lubridate 1.7.4 2018-04-11 [1] CRAN (R 3.6.0) magrittr 1.5 2014-11-22 [1] CRAN (R 3.6.0) memoise 1.1.0 2017-04-21 [1] CRAN (R 3.6.0) modelr 0.1.4 2019-02-18 [1] CRAN (R 3.6.0) munsell 0.5.0 2018-06-12 [1] CRAN (R 3.6.0) nlme 3.1-140 2019-05-12 [1] CRAN (R 3.6.0) pillar 1.4.2 2019-06-29 [1] CRAN (R 3.6.0) pkgbuild 1.0.3 2019-03-20 [1] CRAN (R 3.6.0) pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 3.6.0) pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.6.0) prettyunits 1.0.2 2015-07-13 [1] CRAN (R 3.6.0) processx 3.4.1 2019-07-18 [1] CRAN (R 3.6.0) ps 1.3.0 2018-12-21 [1] CRAN (R 3.6.0) purrr * 0.3.2 2019-03-15 [1] CRAN (R 3.6.0) quoter 0.1.0 2019-07-28 [1] local R6 2.4.0 2019-02-14 [1] CRAN (R 3.6.0) Rcpp 1.0.2 2019-07-25 [1] CRAN (R 3.6.0) readr * 1.3.1 2018-12-21 [1] CRAN (R 3.6.0) readxl 1.3.1 2019-03-13 [1] CRAN (R 3.6.0) remotes 2.0.4 2019-04-10 [1] CRAN (R 3.6.0) rlang 0.4.0.9000 2019-08-03 [1] Github (r-lib/rlang@b0905db) rmarkdown 1.16 2019-10-01 [1] CRAN (R 3.6.0) rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.6.0) rstudioapi 0.10 2019-03-19 [1] CRAN (R 3.6.0) rvest 0.3.4 2019-05-15 [1] CRAN (R 3.6.0) scales 1.0.0 2018-08-09 [1] CRAN (R 3.6.0) sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.0) stringi 1.4.3 2019-03-12 [1] CRAN (R 3.6.0) stringr * 1.4.0 2019-02-10 [1] CRAN (R 3.6.0) testthat 2.2.1 2019-07-25 [1] CRAN (R 3.6.0) tibble * 2.1.3 2019-06-06 [1] CRAN (R 3.6.0) tidyr * 1.0.0 2019-09-11 [1] CRAN (R 3.6.0) tidyselect 0.2.5 2018-10-11 [1] CRAN (R 3.6.0) tidyverse * 1.2.1 2017-11-14 [1] CRAN (R 3.6.0) usethis 1.5.0 2019-04-07 [1] CRAN (R 3.6.0) vctrs 0.2.0.9000 2019-08-03 [1] Github (r-lib/vctrs@11c34ae) withr 2.1.2 2018-03-15 [1] CRAN (R 3.6.0) xaringan 0.9 2019-03-06 [1] CRAN (R 3.6.0) xfun 0.10 2019-10-01 [1] CRAN (R 3.6.0) xml2 1.2.0 2018-01-24 [1] CRAN (R 3.6.0) yaml 2.2.0 2018-07-25 [1] CRAN (R 3.6.0) zeallot 0.1.0 2018-01-28 [1] CRAN (R 3.6.0) [1] /Library/Frameworks/R.framework/Versions/3.6/Resources/library ``` <p></p> ::: These slides are licensed under <br><center><a href="https://creativecommons.org/licenses/by-sa/3.0/au/"><img src="images/cc.svg" style="height:2em;"/><img src="images/by.svg" style="height:2em;"/><img src="images/sa.svg" style="height:2em;"/></a></center>