What is RMarkdo w n ? C OMMU N IC ATIN G W ITH DATA IN TH E TIDYVE R SE Timo Grossenbacher Data Jo u rnalist
What y o u ha v e done so far ... loaded the necessar y libraries ... preprocessed the data w ith mutate() and filter() ... de � ned a c u stom theme ... created a dot plot ... polished that plot and made it � t for mobile screens COMMUNICATING WITH DATA IN THE TIDYVERSE
1 Taken from rmarkdo w n . rst u dio . com ( h � p :// rmarkdo w n . rst u dio . com / images / RMarkdo w nO u tp u tFormats . png ) COMMUNICATING WITH DATA IN THE TIDYVERSE
COMMUNICATING WITH DATA IN THE TIDYVERSE
Behind the scenes 1 R for Data Science ( h � p :// r 4 ds . had . co . n z/ r - markdo w n . html ) COMMUNICATING WITH DATA IN THE TIDYVERSE
Reprod u cibilit y Ad v antages others can reprod u ce and q u estion y o u r w ork y o u can a u tomate y o u r w ork � o w Prereq u isites the code needs to be e x ec u table the data needs to be pro v ided or at least linked to ( the so �w are en v ironment needs to be kno w n ) COMMUNICATING WITH DATA IN THE TIDYVERSE
Let ' s practice ! C OMMU N IC ATIN G W ITH DATA IN TH E TIDYVE R SE
Formatting w ith Markdo w n C OMMU N IC ATIN G W ITH DATA IN TH E TIDYVE R SE Timo Grossenbacher Data Jo u rnalist
Markdo w n Markdo w n w as created in 2004 b y John Gr u ber , w ith the goal of of enabling people " to w rite u sing an eas y- to - read , eas y- to -w rite plain te x t format , then con v ert it to str u ct u rall y v alid HTML ". 1 Daring � reball . net ( h � ps ://w eb . archi v e . org /w eb /20040402182332/ h � p :// daring � reball . net / projects / markdo w n /) COMMUNICATING WITH DATA IN THE TIDYVERSE
Markdo w n # A short text <h1>A short text</h1> ## Introduction <h2>Introduction</h2> Hello, *my name* is Hello, <em>my name</em> is **Timo Grossenbacher** and I <strong>Timo Grossenbacher</strong> work at and I work at [SRF Data](https://srf.ch/data). <a href = "https://srf.ch/data"> SRF Data</a>. A short te x t Introd u ction Hello , m y name is Timo Grossenbacher and I w ork at SRF Data . COMMUNICATING WITH DATA IN THE TIDYVERSE
Pandoc Markdo w n RMarkdo w n = Markdo w n prose + R code For all forma � ing options see the Pandoc Markdo w n Reference COMMUNICATING WITH DATA IN THE TIDYVERSE
Let ' s p u t this into practice ! C OMMU N IC ATIN G W ITH DATA IN TH E TIDYVE R SE
R code in RMarkdo w n doc u ments C OMMU N IC ATIN G W ITH DATA IN TH E TIDYVE R SE Timo Grossenbacher Data Jo u rnalist
COMMUNICATING WITH DATA IN THE TIDYVERSE
Adding R ch u nks ```{r} x <- 2 + 2 x ``` 4 2 plus 2 equals `r 2 + 2`. 2 pl u s 2 eq u als 4. COMMUNICATING WITH DATA IN THE TIDYVERSE
The ` knitr ` package 1 R for Data Science ( h � p :// r 4 ds . had . co . n z/ r - markdo w n . html ) COMMUNICATING WITH DATA IN THE TIDYVERSE
R ch u nk options ```{r include=FALSE} x <- 2 + 2 x ``` ```{r} x ``` 4 COMMUNICATING WITH DATA IN THE TIDYVERSE
More R ch u nk options Option E � ect include Whether to sho w the R code ch u nk and its o u tp u t . echo Whether to sho w the R code ch u nk . message Whether to sho w o u tp u t messages . warning Whether to sho w o u tp u t w arnings . eval Whether to act u all y e v al u ate the R code ch u nk . More options on the respecti v e help page of the knitr package . COMMUNICATING WITH DATA IN THE TIDYVERSE
Let ' s tr y this o u t ! C OMMU N IC ATIN G W ITH DATA IN TH E TIDYVE R SE
Images in RMarkdo w n files C OMMU N IC ATIN G W ITH DATA IN TH E TIDYVE R SE Timo Grossenbacher Data Jo u rnalist
COMMUNICATING WITH DATA IN THE TIDYVERSE
Adj u sting fig u re options in RMarkdo w n ```{r} ... ggplot2 code ... ``` COMMUNICATING WITH DATA IN THE TIDYVERSE
Adj u sting fig u re options in RMarkdo w n ```{r fig.height = 6} ... ggplot2 code ... ``` COMMUNICATING WITH DATA IN THE TIDYVERSE
Fig u re options Option Possible v al u es E � ect fig.height N u meric , inches The height of the image in inches . fig.width N u meric , inches The w idth of the image in inches . fig.align One of " le �", " right " or " center " The alignment of the image in the report . More options on the respecti v e help page of the knitr package . COMMUNICATING WITH DATA IN THE TIDYVERSE
E x ternal images in RMarkdo w n reports ![An impressive mountain](https://upload.wikimedia.org/wikipedia/commons/thumb/6/60/ Matterhorn_from_Domh%C3%BCtte_-_2.jpg/1200px-Matterhorn_from_Domh%C3%BCtte_-_2.jpg) An impressi v e mo u ntain COMMUNICATING WITH DATA IN THE TIDYVERSE
Let ' s practice ! C OMMU N IC ATIN G W ITH DATA IN TH E TIDYVE R SE
Recommend
More recommend