This template aimed at doing the following: preparing a flipbook from within an .Rmd source file and then embedded it in the resulting html. Narrative might be interspersed between the code-movies.
#remotes::install_github("gadenbuie/xaringanExtra")
# This is the recommended set up for flipbooks # you might think about setting cache to TRUE as you gain practice --- building flipbooks from scratch can be time consuming # options(knitr.duplicate.label = "allow") knitr::opts_chunk$set(fig.width = 6, message = FALSE, warning = FALSE, comment = "", cache = F, error = F) library(flipbookr) library(tidyverse)
# you can just delete this whole code chunk -- it's just for testing and developing the package try(source("../../../../../R/a_create_test_code.R")) try(source("../../../../../R/b_parsing.R")) try(source("../../../../../R/c_prep_sequences.R")) try(source("../../../../../R/d_prep_rmd_chunks.R")) try(source("../../../../../R/e_define_css.R")) try(source("../../../../../R/f_chunk_expand.R")) try(source("../../../../../R/g_exported_functions.R")) try(source("../../../../../R/h_write_instant_flipbook.R"))
You might think about setting this code chunk's option include = F, to hide the code and output.
cars %>% ggplot() + aes(x = dist) + aes(y = speed) + geom_point() -> g
You might want to set the code chunk options to echo = F, unless you are demoing embed_flibook().
flipbookr:::embed_flipbook(chunk_name = "my_code", use_share_again = T, font_size = 120)
You might just set the code chunk options include = F.
g + theme_minimal(base_size = 12) + aes(size = dist) + aes(color = dist) + scale_color_viridis_c() + geom_smooth() + theme(legend.position = "none") + labs(x = "Distance") + labs(y = "Speed") + #BREAK labs(title = "Cool plot!") + theme(plot.title.position = "plot") #BREAK
You might set the code chunk option echo = F
flipbookr:::embed_flipbook(chunk_name = "fine_tuning", use_share_again = T, use_embed_xaringan = T, font_size = 100, title_page = T, title = "How to Style your Plot", subtitle = "Thematic Adjustments", author = "Reynolds Lab", break_type = "user")
```{python hello_python, include = T} [1, 4] * 8
3 + 4 * 8
2 + 6
4 * 8
[1,2] + [3,4,5,6]
["hello", "world!", 1, 2, 3] * 2
import numpy as np
np.reshape(np.arange(1,25), (4,3,2), "F")
```r flipbookr:::embed_flipbook("hello_python", lang = "python")
embed_text_flipbook("hi there good seeing you", title = "greetings", sep = " ", use_embed_xaringan = T)
```{css, eval = TRUE, echo = FALSE} .remark-code{line-height: 1.5; font-size: 80%}
@media print { .has-continuation { display: block; } } ```
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.