Rmarkdown files are so cool. They let you to combine prose, code, and code output in a single output file. And getting up and running with .Rmds is pretty easy — learn bit about code chunks, a bit of markdown and you are good to go.
But there is a lot that you can do in .Rmds beyond the basics. So you may feel .Rmd admiration and wonder at the products of more advanced users. How did they to that?
Or maybe as an advanced user you might get asked: How did you produce those slides, poster, dashboard etc.? You can answer ‘xaringan’ or ‘knitr’, but can you deliver ‘the how-to goods’ in a detailed way when you get this question? (Another common sensation, looking back at your own work, may be ‘how did I get that done?’)
The goal of doublecrochet is to help produce a companion output from your .Rmd – one that has .Rmd source snippets quoted close to the rendered output.
The package now focused a case where there are natural breakpoints – slideshows! Quoted source is presented on a slide, then the rendered content is shown.
Check out doublecrochet’s in action below. The first set of slides is a slide show of ‘Cool Xaringan Stuff’, and the second is the Double Crochetted version that quotes the slide source.
Cool Xaringan Stuff Open in New tab
Cool Xaringan Stuff Double Crocheted View in new tab:
Inspiration for this project was creating Easy Flipbooks Recipes where I was quoting my source a bunch w/ copy paste and fancy fencing. I only got through 4 ‘recipes’. But there were more ‘recipes’ that I’d like to share.
Having ‘doublecrochet’ working should be nice for communicating about how to use flipbookr – and other cool xaringan-complementary packages.
2022 update: Now quoting the .Rmd verbatim is done using the new verbatim engine from knitr!
The development version from GitHub with:
# install.packages("remotes")
remotes::install_github("EvaMaeRey/doublecrochet")
For now doublecrochet::crochet() is intended for use with xaringan .Rmd slide show files:
library(doublecrochet)
## a text .rmd file stored on github
download.file(
url = "https://raw.githubusercontent.com/EvaMaeRey/doublecrochet/master/inst/rmarkdown/templates/double-crochet/skeleton/skeleton.Rmd",
destfile = "docs/cool_xaringan_stuff.Rmd")
# regular render of xaringan .Rmd
rmarkdown::render(input = "docs/cool_xaringan_stuff.Rmd")
# double crochet render
doublecrochet::crochet(input = "docs/cool_xaringan_stuff.Rmd", render = T)
Once you have the ‘doublecrochet’ version of your .Rmd, you can try to compile and render this and you’ll have html output. Source will be quoted throughout.
Doublecrochet doesn’t do a good job of showing bigger picture and global style changes in a file.