Branding and Packaging Reports with R Markdown · Branding and Packaging Reports with R Markdown!...
Transcript of Branding and Packaging Reports with R Markdown · Branding and Packaging Reports with R Markdown!...
![Page 1: Branding and Packaging Reports with R Markdown · Branding and Packaging Reports with R Markdown! bit.ly/ratlas-rstudioconf! wjakethompson " @wjakethompson " wjakethompson.com Jake](https://reader030.fdocuments.net/reader030/viewer/2022041110/5f1067b17e708231d448f2a8/html5/thumbnails/1.jpg)
Branding and Packaging Reports with R Markdown
! wjakethompson! bit.ly/ratlas-rstudioconf
" wjakethompson.com" @wjakethompson
Jake Thompson, PhDUniversity of KansasAccessible Teaching, Learning, and Assessment Systems
2020-01-30 ● rstudio::conf(2020)
![Page 2: Branding and Packaging Reports with R Markdown · Branding and Packaging Reports with R Markdown! bit.ly/ratlas-rstudioconf! wjakethompson " @wjakethompson " wjakethompson.com Jake](https://reader030.fdocuments.net/reader030/viewer/2022041110/5f1067b17e708231d448f2a8/html5/thumbnails/2.jpg)
Noelle Pablo Assistant Psychometrician University of Kansas, ATLAS
" @noelle_pablo ! noellepablo
Jeff Hoover Graduate Research Assistant University of Kansas, ATLAS
" @JeffreyCHoover ! JeffreyCHoover
! bit.ly/ratlas-rstudioconf
![Page 3: Branding and Packaging Reports with R Markdown · Branding and Packaging Reports with R Markdown! bit.ly/ratlas-rstudioconf! wjakethompson " @wjakethompson " wjakethompson.com Jake](https://reader030.fdocuments.net/reader030/viewer/2022041110/5f1067b17e708231d448f2a8/html5/thumbnails/3.jpg)
Reports with R Markdown• Reproducible
• Dynamic
• Multiple output formats
! bit.ly/ratlas-rstudioconf
![Page 8: Branding and Packaging Reports with R Markdown · Branding and Packaging Reports with R Markdown! bit.ly/ratlas-rstudioconf! wjakethompson " @wjakethompson " wjakethompson.com Jake](https://reader030.fdocuments.net/reader030/viewer/2022041110/5f1067b17e708231d448f2a8/html5/thumbnails/8.jpg)
Building a Word Template1. Start writing document in R
Markdown.
! bit.ly/ratlas-rstudioconf
![Page 9: Branding and Packaging Reports with R Markdown · Branding and Packaging Reports with R Markdown! bit.ly/ratlas-rstudioconf! wjakethompson " @wjakethompson " wjakethompson.com Jake](https://reader030.fdocuments.net/reader030/viewer/2022041110/5f1067b17e708231d448f2a8/html5/thumbnails/9.jpg)
Building a Word Template1. Start writing document in R
Markdown.
2. Knit your document.
! bit.ly/ratlas-rstudioconf
![Page 10: Branding and Packaging Reports with R Markdown · Branding and Packaging Reports with R Markdown! bit.ly/ratlas-rstudioconf! wjakethompson " @wjakethompson " wjakethompson.com Jake](https://reader030.fdocuments.net/reader030/viewer/2022041110/5f1067b17e708231d448f2a8/html5/thumbnails/10.jpg)
Building a Word Template1. Start writing document in R
Markdown.
2. Knit your document.
3. Style and save your word document.
! bit.ly/ratlas-rstudioconf
![Page 11: Branding and Packaging Reports with R Markdown · Branding and Packaging Reports with R Markdown! bit.ly/ratlas-rstudioconf! wjakethompson " @wjakethompson " wjakethompson.com Jake](https://reader030.fdocuments.net/reader030/viewer/2022041110/5f1067b17e708231d448f2a8/html5/thumbnails/11.jpg)
Building a Word Template1. Start writing document in R
Markdown.
2. Knit your document.
3. Style and save your word document.
4. Define your template in your YAML.
! bit.ly/ratlas-rstudioconf
![Page 12: Branding and Packaging Reports with R Markdown · Branding and Packaging Reports with R Markdown! bit.ly/ratlas-rstudioconf! wjakethompson " @wjakethompson " wjakethompson.com Jake](https://reader030.fdocuments.net/reader030/viewer/2022041110/5f1067b17e708231d448f2a8/html5/thumbnails/12.jpg)
Resources!• Branding and Automating with R Markdown - Daniel Hadley
• Happy Collaboration with Rmd to docx - Richard Layton
• R Markdown: The Definitive Guide - Yuihui Xie, J. J. Allair, Garrett Grolemund
! bit.ly/ratlas-rstudioconf
![Page 13: Branding and Packaging Reports with R Markdown · Branding and Packaging Reports with R Markdown! bit.ly/ratlas-rstudioconf! wjakethompson " @wjakethompson " wjakethompson.com Jake](https://reader030.fdocuments.net/reader030/viewer/2022041110/5f1067b17e708231d448f2a8/html5/thumbnails/13.jpg)
Step 3: Polish• Custom {ggplot2} themes
• {hrbrthemes} - Bob Rudis
• {Rtistic} - Emily Riederer
• {bbplot} - BBC
• Default {knitr} chunks • {knitr} options guide
! bit.ly/ratlas-rstudioconf
![Page 14: Branding and Packaging Reports with R Markdown · Branding and Packaging Reports with R Markdown! bit.ly/ratlas-rstudioconf! wjakethompson " @wjakethompson " wjakethompson.com Jake](https://reader030.fdocuments.net/reader030/viewer/2022041110/5f1067b17e708231d448f2a8/html5/thumbnails/14.jpg)
What Next?Copy and paste into each project
• Templates
• {ggplot2} themes
• Other settings
Wrap it up in an R package!
• Always have the right version
• Easy to distribute
• Documentation included
! bit.ly/ratlas-rstudioconf
![Page 15: Branding and Packaging Reports with R Markdown · Branding and Packaging Reports with R Markdown! bit.ly/ratlas-rstudioconf! wjakethompson " @wjakethompson " wjakethompson.com Jake](https://reader030.fdocuments.net/reader030/viewer/2022041110/5f1067b17e708231d448f2a8/html5/thumbnails/15.jpg)
Use Case: ratlas• Templates for reports
• Convenient project templates
• {ggplot2} themes
• Vignettes!
! bit.ly/ratlas-rstudioconf
![Page 16: Branding and Packaging Reports with R Markdown · Branding and Packaging Reports with R Markdown! bit.ly/ratlas-rstudioconf! wjakethompson " @wjakethompson " wjakethompson.com Jake](https://reader030.fdocuments.net/reader030/viewer/2022041110/5f1067b17e708231d448f2a8/html5/thumbnails/16.jpg)
Package Structureratlas |-- DESCRIPTION |-- inst | |-- rmarkdown | |-- rstudio |-- man |-- NAMESPACE |-- R |-- README.md |-- tests |-- vignettes
! bit.ly/ratlas-rstudioconf
![Page 17: Branding and Packaging Reports with R Markdown · Branding and Packaging Reports with R Markdown! bit.ly/ratlas-rstudioconf! wjakethompson " @wjakethompson " wjakethompson.com Jake](https://reader030.fdocuments.net/reader030/viewer/2022041110/5f1067b17e708231d448f2a8/html5/thumbnails/17.jpg)
inst/rmarkdown/ratlas |-- inst | |-- rmarkdown | |-- templates | |-- topicguide | |-- resources | |-- template.docx | |-- techreport | |-- resources | |-- template.tex
! bit.ly/ratlas-rstudioconf
![Page 18: Branding and Packaging Reports with R Markdown · Branding and Packaging Reports with R Markdown! bit.ly/ratlas-rstudioconf! wjakethompson " @wjakethompson " wjakethompson.com Jake](https://reader030.fdocuments.net/reader030/viewer/2022041110/5f1067b17e708231d448f2a8/html5/thumbnails/18.jpg)
R/render.Rtopicguide_docx <- function(...) { template <- system.file("rmarkdown", "templates", "topicguide", "template.docx") base <- bookdown::word_document2(reference_docx = template, ...)
base$knitr$opts_chunk$echo <- FALSE base$knitr$opts_chunk$fig.asp <- 0.618
base }
! bit.ly/ratlas-rstudioconf
![Page 19: Branding and Packaging Reports with R Markdown · Branding and Packaging Reports with R Markdown! bit.ly/ratlas-rstudioconf! wjakethompson " @wjakethompson " wjakethompson.com Jake](https://reader030.fdocuments.net/reader030/viewer/2022041110/5f1067b17e708231d448f2a8/html5/thumbnails/19.jpg)
inst/rstudio/ratlas |-- inst | |-- rstudio | |-- templates | |-- project | |-- topicguide.dcf | |-- topicguide_resources | |-- index.Rmd | |-- references.bib
! bit.ly/ratlas-rstudioconf
![Page 24: Branding and Packaging Reports with R Markdown · Branding and Packaging Reports with R Markdown! bit.ly/ratlas-rstudioconf! wjakethompson " @wjakethompson " wjakethompson.com Jake](https://reader030.fdocuments.net/reader030/viewer/2022041110/5f1067b17e708231d448f2a8/html5/thumbnails/24.jpg)
Other Examples!• sorensonimpact
• Sorenson Impact Center
• Jonathan Zadra, Daniel Hadley, & Gwendolyn Reynolds
• thesisdown • Reed College (with many forks)
• Chester Ismay
• rticles • Journal LaTeX templates
• J. J. Allaire, Yihui Xie, R Foundation, et al.
! bit.ly/ratlas-rstudioconf
![Page 25: Branding and Packaging Reports with R Markdown · Branding and Packaging Reports with R Markdown! bit.ly/ratlas-rstudioconf! wjakethompson " @wjakethompson " wjakethompson.com Jake](https://reader030.fdocuments.net/reader030/viewer/2022041110/5f1067b17e708231d448f2a8/html5/thumbnails/25.jpg)
Thank you!! bit.ly/ratlas-rstudioconf
" @wjakethompson
" wjakethompson.com