knitr::opts_chunk$set(echo = TRUE, message = F, 
                      warning = F, comment = "",
                      fig.height = 4, cache = T)
library(tidyverse)
library(flipbookr)
options(knitr.duplicate.label = "allow")
xaringanExtra::use_share_again()

If you make an amazing presentation with {xaringan}, people may ask:

--

.pull-left[#How did you make those neat slides?]

--

with {doublecrochet} you can render a second 'how-to-xaringan' presentation -- with little extra work for you!

--


But first let's look at some of the amazing things you can do in {xaringan}!

```{css style, eval = TRUE, echo = FALSE} .remark-code{line-height: 1.5; font-size: 120%}

```{css style2, eval = TRUE, echo = FALSE}
.left-code {
  color: #777;
  width: 38%;
  height: 92%;
  float: left;
}
.right-plot {
  width: 60%;
  float: right;
  padding-left: 1%;
}

.pull-right[# We do some code highlighting!]

--

ggplot(starwars) +
  aes(x = height) +
  geom_histogram(    #<<
    binwidth = 10,   #<<
    color = "grey85" #<<
  )                  #<<

We can do side-by-side code and plots!

.pull-left[

ggplot(starwars) +
  aes(x = height) +
  aes(y = mass) +
  geom_point() +
  scale_x_log10() + #<<
  scale_y_log10()   #<<

]

.pull-right[


]


look at this mtcars table!

# use 'html' format for tables
knitr::kable(head(mtcars), format = 'html') 

An equation

$$cov(x,y) = \frac{\sum_{i=1}^n (x_i-\mu_x)(y_i-\mu_y)}{n}$$


What about packages that complement {xaringan}?

--

Let's look at


class: inverse, center, middle background-image: url(https://images.unsplash.com/photo-1522210667936-c3402f6742c3?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1402&q=80) background-size: contain

{flipbookr}


r chunk_reveal("explain_dist", chunk_options = "fig.height = 6")

cars %>% 
  ggplot() +
  aes(y = dist) +
  geom_rug() +
  aes(x = speed) +
  geom_point() +
  geom_smooth(method = "lm",
              se = F)

r chunk_reveal("dc_advert", widths = c(1.3, 1))

magick::image_read("https://images.unsplash.com/photo-1577635515158-dcce4789c8fb?ixlib=rb-1.2.1&ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&auto=format&fit=crop&w=751&q=80") %>% 
  magick::image_write(format = "png") %>% 
  ggbackdrop(png = .) +
  stamp_polygon(x0 = 82, y0 = 46, radius = 15,
                fill = "brown", alpha = .2,
                size = 1.5, color = "oldlace",
                linetype = "dotted") + 
  stamp_text(label = "{doublecrochet}",
             fontface = "bold", x = 82, y = 46,
              size = 6, color = "oldlace") + 
  stamp_label(label = ".Rmd source",
              fill = "oldlace", size = 7,
              x = 30, y = 30, color = "grey15") + 
  stamp_label(label = "output", fill = "oldlace",
              x = 60, y = 20, color = "grey15") + 
  stamp_tile(height = 60, width = 93, 
             x = 50, y = 33, alpha = 0, size = 2, 
             color = alpha("oldlace", .7)) + 
  theme_void()

class: inverse, middle, right background-image: url(https://images.unsplash.com/photo-1520999166456-6c498658829d?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1500&q=80) background-size: cover

{flair}


library(flair)
iris %>%
  group_by(Species) %>%
  summarize(mean(Sepal.Length))
decorate("how_to_pipe") %>% 
  flair("%>%")

ggplot(cars) +
  aes(x = speed) +
  aes(y = dist) +
  geom_point() +
  aes(size = speed) +
  aes(color = dist) +
  scale_color_viridis_c()
decorate("chunk_to_flair") %>% 
  flair_funs()

decorate("chunk_to_flair") %>% 
  flair_args(color = "steelblue")

class: inverse, center, middle background-image: url(https://images.unsplash.com/photo-1557428894-56bcc97113fe?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1576&q=80) background-size: contain

{xaringanExtra}


xaringanExtra::use_editable(expires = 1)

.can-edit[You can edit this title. Put your cursor here and get typing]

Or edit this list!

.can-edit.key-likes[ - thing one - thing two ]


xaringanExtra::use_tachyons()

You can write Tachyons:

.bg-washed-green.b--dark-green.ba.bw2.br3.shadow-5.ph4.mt5[ Tachyons provides small, single-purpose CSS classes that are easily composed to achieve larger functionality and styles. In the remarkjs content classes syntax, you can compose classes by chaining them together. For example, the following markdown produces a box with a washed green background (.bg-washed-green) and a dark green border (.b--dark-green) on all sides (.ba) with line width 2 (.bw2) and border radius (.br3). The box has a shadow (.shadow-5) and medium-large horizontal padding (.ph4) with a large top margin (.mt5). .tr[ — Garrick Aden-Buie ]]


xaringanExtra::use_panelset()

.panel[.panel-name[This is a Panel Set] Some things that hang together ]

.panelset[ .panel[.panel-name[R Code]

plot(pressure)

]

.panel[.panel-name[Plot]

plot(pressure)

]

]


And doublecrochetting this presentation is easy...

You'd use code like this:

doublecrochet::doublecrochet("my_presentation.Rmd")

And get html output that can be viewed here{target="_blank"}.



EvaMaeRey/doublecrochet documentation built on Jan. 13, 2022, 7:30 p.m.