class: center, middle, inverse, title-slide # Klaus Schulte’s ggplots, uses Claus Wilke’s new ggtext ## made with {flipbookr} ### Edited by Gina Reynolds, Feb 2020 --- My old twitter friend from #MakeoverMonday tried ggplot for the first time a few weeks ago. He figured out tons of things about ggplot2, and even used Claus Wilke's new ggtext package, and the new ggplot theme option `plot.title.position`. Way to go Klaus! And way to go Claus! <blockquote class="twitter-tweet"><p lang="en" dir="ltr">Getting started with <a href="https://twitter.com/hashtag/Rstats?src=hash&ref_src=twsrc%5Etfw">#Rstats</a>, <a href="https://twitter.com/hashtag/rstudio?src=hash&ref_src=twsrc%5Etfw">#rstudio</a> and <a href="https://twitter.com/hashtag/ggplot2?src=hash&ref_src=twsrc%5Etfw">#ggplot2</a> was my project of the week. My first chart was a lot more work than expected and is inspired by <a href="https://twitter.com/barnabasmarkus?ref_src=twsrc%5Etfw">@barnabasmarkus</a> <a href="https://twitter.com/hashtag/makeovermonday?src=hash&ref_src=twsrc%5Etfw">#makeovermonday</a> from week 1. Thanks <a href="https://twitter.com/EvaMaeRey?ref_src=twsrc%5Etfw">@EvaMaeRey</a> for support, my code is probably lousy, but I will build up on this! <a href="https://t.co/2dggPFrwrX">pic.twitter.com/2dggPFrwrX</a></p>— Klaus Schulte (@ProfDrKSchulte) <a href="https://twitter.com/ProfDrKSchulte/status/1222160205351464960?ref_src=twsrc%5Etfw">January 28, 2020</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> --- ```r library("httr") library("readxl") df <- readxl::read_excel("sports_data.xlsx") knitr::opts_chunk$set(cache = T, comment = "") ``` --- ```r library(tidyverse) ``` --- class: split-40 count: false .column[.content[ ```r *df ``` ]] .column[.content[ ``` # A tibble: 22 x 8 Sport `2017` `2013` `2008` `2007` `2006` `2005` `2004` <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 Football 37 39 41 43 43 34 37 2 Basketball 11 12 9 11 12 12 13 3 Baseball 9 14 10 13 11 12 10 4 Soccer 7 4 3 2 2 3 2 5 Ice hockey 4 3 4 4 2 4 3 6 Auto racing 2 2 3 3 4 5 5 7 Tennis 2 3 1 1 1 3 2 8 Golf 1 2 2 2 3 2 2 9 Volleyball 1 0 1 0 0 1 0 10 Boxing 1 1 2 1 2 1 1 # … with 12 more rows ``` ]] --- class: split-40 count: false .column[.content[ ```r df %>% * janitor::clean_names() ``` ]] .column[.content[ ``` # A tibble: 22 x 8 sport x2017 x2013 x2008 x2007 x2006 x2005 x2004 <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 Football 37 39 41 43 43 34 37 2 Basketball 11 12 9 11 12 12 13 3 Baseball 9 14 10 13 11 12 10 4 Soccer 7 4 3 2 2 3 2 5 Ice hockey 4 3 4 4 2 4 3 6 Auto racing 2 2 3 3 4 5 5 7 Tennis 2 3 1 1 1 3 2 8 Golf 1 2 2 2 3 2 2 9 Volleyball 1 0 1 0 0 1 0 10 Boxing 1 1 2 1 2 1 1 # … with 12 more rows ``` ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% * arrange(-x2017) ``` ]] .column[.content[ ``` # A tibble: 22 x 8 sport x2017 x2013 x2008 x2007 x2006 x2005 x2004 <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 Football 37 39 41 43 43 34 37 2 None 15 11 14 12 12 13 12 3 Basketball 11 12 9 11 12 12 13 4 Baseball 9 14 10 13 11 12 10 5 Soccer 7 4 3 2 2 3 2 6 Other 5 4 6 3 3 4 4 7 Ice hockey 4 3 4 4 2 4 3 8 Auto racing 2 2 3 3 4 5 5 9 Tennis 2 3 1 1 1 3 2 10 Golf 1 2 2 2 3 2 2 # … with 12 more rows ``` ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% arrange(-x2017) %>% * select(1:2) ``` ]] .column[.content[ ``` # A tibble: 22 x 2 sport x2017 <chr> <dbl> 1 Football 37 2 None 15 3 Basketball 11 4 Baseball 9 5 Soccer 7 6 Other 5 7 Ice hockey 4 8 Auto racing 2 9 Tennis 2 10 Golf 1 # … with 12 more rows ``` ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% arrange(-x2017) %>% select(1:2) %>% * mutate(sport_dummy = sport != "None") ``` ]] .column[.content[ ``` # A tibble: 22 x 3 sport x2017 sport_dummy <chr> <dbl> <lgl> 1 Football 37 TRUE 2 None 15 FALSE 3 Basketball 11 TRUE 4 Baseball 9 TRUE 5 Soccer 7 TRUE 6 Other 5 TRUE 7 Ice hockey 4 TRUE 8 Auto racing 2 TRUE 9 Tennis 2 TRUE 10 Golf 1 TRUE # … with 12 more rows ``` ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% arrange(-x2017) %>% select(1:2) %>% mutate(sport_dummy = sport != "None") %>% * slice(1:10) ``` ]] .column[.content[ ``` # A tibble: 10 x 3 sport x2017 sport_dummy <chr> <dbl> <lgl> 1 Football 37 TRUE 2 None 15 FALSE 3 Basketball 11 TRUE 4 Baseball 9 TRUE 5 Soccer 7 TRUE 6 Other 5 TRUE 7 Ice hockey 4 TRUE 8 Auto racing 2 TRUE 9 Tennis 2 TRUE 10 Golf 1 TRUE ``` ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% arrange(-x2017) %>% select(1:2) %>% mutate(sport_dummy = sport != "None") %>% slice(1:10) %>% *ggplot() ``` ]] .column[.content[ ![](ggtext_files/figure-html/wrangle_auto_7_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% arrange(-x2017) %>% select(1:2) %>% mutate(sport_dummy = sport != "None") %>% slice(1:10) %>% ggplot() + * aes(x = sport) ``` ]] .column[.content[ ![](ggtext_files/figure-html/wrangle_auto_8_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% arrange(-x2017) %>% select(1:2) %>% mutate(sport_dummy = sport != "None") %>% slice(1:10) %>% ggplot() + aes(x = sport) + * aes(y = x2017) ``` ]] .column[.content[ ![](ggtext_files/figure-html/wrangle_auto_9_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% arrange(-x2017) %>% select(1:2) %>% mutate(sport_dummy = sport != "None") %>% slice(1:10) %>% ggplot() + aes(x = sport) + aes(y = x2017) + * geom_col(width = 0.6) ``` ]] .column[.content[ ![](ggtext_files/figure-html/wrangle_auto_10_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% arrange(-x2017) %>% select(1:2) %>% mutate(sport_dummy = sport != "None") %>% slice(1:10) %>% ggplot() + aes(x = sport) + aes(y = x2017) + geom_col(width = 0.6) + * aes(fill = sport_dummy) ``` ]] .column[.content[ ![](ggtext_files/figure-html/wrangle_auto_11_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% arrange(-x2017) %>% select(1:2) %>% mutate(sport_dummy = sport != "None") %>% slice(1:10) %>% ggplot() + aes(x = sport) + aes(y = x2017) + geom_col(width = 0.6) + aes(fill = sport_dummy) + * scale_fill_manual(values = * c("#F11B59", "#8d8d8d")) ``` ]] .column[.content[ ![](ggtext_files/figure-html/wrangle_auto_12_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% arrange(-x2017) %>% select(1:2) %>% mutate(sport_dummy = sport != "None") %>% slice(1:10) %>% ggplot() + aes(x = sport) + aes(y = x2017) + geom_col(width = 0.6) + aes(fill = sport_dummy) + scale_fill_manual(values = c("#F11B59", "#8d8d8d")) + * coord_flip() ``` ]] .column[.content[ ![](ggtext_files/figure-html/wrangle_auto_13_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% arrange(-x2017) %>% select(1:2) %>% mutate(sport_dummy = sport != "None") %>% slice(1:10) %>% ggplot() + aes(x = sport) + aes(y = x2017) + geom_col(width = 0.6) + aes(fill = sport_dummy) + scale_fill_manual(values = c("#F11B59", "#8d8d8d")) + coord_flip() + * aes(x = reorder(sport, x2017)) ``` ]] .column[.content[ ![](ggtext_files/figure-html/wrangle_auto_14_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% arrange(-x2017) %>% select(1:2) %>% mutate(sport_dummy = sport != "None") %>% slice(1:10) %>% ggplot() + aes(x = sport) + aes(y = x2017) + geom_col(width = 0.6) + aes(fill = sport_dummy) + scale_fill_manual(values = c("#F11B59", "#8d8d8d")) + coord_flip() + aes(x = reorder(sport, x2017)) + * geom_text(aes(label = x2017), * nudge_y = 1) ``` ]] .column[.content[ ![](ggtext_files/figure-html/wrangle_auto_15_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% arrange(-x2017) %>% select(1:2) %>% mutate(sport_dummy = sport != "None") %>% slice(1:10) %>% ggplot() + aes(x = sport) + aes(y = x2017) + geom_col(width = 0.6) + aes(fill = sport_dummy) + scale_fill_manual(values = c("#F11B59", "#8d8d8d")) + coord_flip() + aes(x = reorder(sport, x2017)) + geom_text(aes(label = x2017), nudge_y = 1) + * aes(color = sport_dummy) ``` ]] .column[.content[ ![](ggtext_files/figure-html/wrangle_auto_16_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% arrange(-x2017) %>% select(1:2) %>% mutate(sport_dummy = sport != "None") %>% slice(1:10) %>% ggplot() + aes(x = sport) + aes(y = x2017) + geom_col(width = 0.6) + aes(fill = sport_dummy) + scale_fill_manual(values = c("#F11B59", "#8d8d8d")) + coord_flip() + aes(x = reorder(sport, x2017)) + geom_text(aes(label = x2017), nudge_y = 1) + aes(color = sport_dummy) + * scale_color_manual(values = * c("#F11B59", "#8d8d8d")) ``` ]] .column[.content[ ![](ggtext_files/figure-html/wrangle_auto_17_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% arrange(-x2017) %>% select(1:2) %>% mutate(sport_dummy = sport != "None") %>% slice(1:10) %>% ggplot() + aes(x = sport) + aes(y = x2017) + geom_col(width = 0.6) + aes(fill = sport_dummy) + scale_fill_manual(values = c("#F11B59", "#8d8d8d")) + coord_flip() + aes(x = reorder(sport, x2017)) + geom_text(aes(label = x2017), nudge_y = 1) + aes(color = sport_dummy) + scale_color_manual(values = c("#F11B59", "#8d8d8d")) + * theme_minimal() ``` ]] .column[.content[ ![](ggtext_files/figure-html/wrangle_auto_18_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% arrange(-x2017) %>% select(1:2) %>% mutate(sport_dummy = sport != "None") %>% slice(1:10) %>% ggplot() + aes(x = sport) + aes(y = x2017) + geom_col(width = 0.6) + aes(fill = sport_dummy) + scale_fill_manual(values = c("#F11B59", "#8d8d8d")) + coord_flip() + aes(x = reorder(sport, x2017)) + geom_text(aes(label = x2017), nudge_y = 1) + aes(color = sport_dummy) + scale_color_manual(values = c("#F11B59", "#8d8d8d")) + theme_minimal() + * theme(legend.position = "none", #no legend * plot.margin = margin(35, 35, 10, 35)) ``` ]] .column[.content[ ![](ggtext_files/figure-html/wrangle_auto_19_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% arrange(-x2017) %>% select(1:2) %>% mutate(sport_dummy = sport != "None") %>% slice(1:10) %>% ggplot() + aes(x = sport) + aes(y = x2017) + geom_col(width = 0.6) + aes(fill = sport_dummy) + scale_fill_manual(values = c("#F11B59", "#8d8d8d")) + coord_flip() + aes(x = reorder(sport, x2017)) + geom_text(aes(label = x2017), nudge_y = 1) + aes(color = sport_dummy) + scale_color_manual(values = c("#F11B59", "#8d8d8d")) + theme_minimal() + theme(legend.position = "none", #no legend plot.margin = margin(35, 35, 10, 35)) + * labs(x = NULL) ``` ]] .column[.content[ ![](ggtext_files/figure-html/wrangle_auto_20_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% arrange(-x2017) %>% select(1:2) %>% mutate(sport_dummy = sport != "None") %>% slice(1:10) %>% ggplot() + aes(x = sport) + aes(y = x2017) + geom_col(width = 0.6) + aes(fill = sport_dummy) + scale_fill_manual(values = c("#F11B59", "#8d8d8d")) + coord_flip() + aes(x = reorder(sport, x2017)) + geom_text(aes(label = x2017), nudge_y = 1) + aes(color = sport_dummy) + scale_color_manual(values = c("#F11B59", "#8d8d8d")) + theme_minimal() + theme(legend.position = "none", #no legend plot.margin = margin(35, 35, 10, 35)) + labs(x = NULL) + * labs(y = NULL) ``` ]] .column[.content[ ![](ggtext_files/figure-html/wrangle_auto_21_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r df %>% janitor::clean_names() %>% arrange(-x2017) %>% select(1:2) %>% mutate(sport_dummy = sport != "None") %>% slice(1:10) %>% ggplot() + aes(x = sport) + aes(y = x2017) + geom_col(width = 0.6) + aes(fill = sport_dummy) + scale_fill_manual(values = c("#F11B59", "#8d8d8d")) + coord_flip() + aes(x = reorder(sport, x2017)) + geom_text(aes(label = x2017), nudge_y = 1) + aes(color = sport_dummy) + scale_color_manual(values = c("#F11B59", "#8d8d8d")) + theme_minimal() + theme(legend.position = "none", #no legend plot.margin = margin(35, 35, 10, 35)) + labs(x = NULL) + labs(y = NULL) -> *g ``` ]] .column[.content[ ]] --- class: split-40 count: false .column[.content[ ```r # now all the ggtext goodness *g ``` ]] .column[.content[ ![](ggtext_files/figure-html/ggtext_auto_1_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r # now all the ggtext goodness g + * labs(caption = paste0( * "#makeovermonday 01/2020 | ", * "@ProfDrKSchulte | Inspired by: @barnabasmarkus") * ) ``` ]] .column[.content[ ![](ggtext_files/figure-html/ggtext_auto_2_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r # now all the ggtext goodness g + labs(caption = paste0( "#makeovermonday 01/2020 | ", "@ProfDrKSchulte | Inspired by: @barnabasmarkus") ) + * theme(plot.caption = ggtext::element_textbox_simple( * size = 10, * lineheight = 1, * padding = margin(10, 10, 10, 10), * margin = margin(10, 0, 10, 0), * fill = "#F5F5F5", * halign = 0.5, * valign = 0.5)) ``` ]] .column[.content[ ![](ggtext_files/figure-html/ggtext_auto_3_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r # now all the ggtext goodness g + labs(caption = paste0( "#makeovermonday 01/2020 | ", "@ProfDrKSchulte | Inspired by: @barnabasmarkus") ) + theme(plot.caption = ggtext::element_textbox_simple( size = 10, lineheight = 1, padding = margin(10, 10, 10, 10), margin = margin(10, 0, 10, 0), fill = "#F5F5F5", halign = 0.5, valign = 0.5)) + * labs(title = paste0( * "<b><span style = 'font-size:20pt'>15% of", * "<span style = 'color:#F11B59;'> ", * "**Americans Have no Favorite Spectator Sport**", * "</span></span></b>", * "<br><b><span style = 'font-size:14pt'>", * "Share of Answers to **Gallup** question ", * "*'What is your favorite sport to watch?'* ", * "in 20017", * "</span></b><br>") * ) ``` ]] .column[.content[ ![](ggtext_files/figure-html/ggtext_auto_4_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r # now all the ggtext goodness g + labs(caption = paste0( "#makeovermonday 01/2020 | ", "@ProfDrKSchulte | Inspired by: @barnabasmarkus") ) + theme(plot.caption = ggtext::element_textbox_simple( size = 10, lineheight = 1, padding = margin(10, 10, 10, 10), margin = margin(10, 0, 10, 0), fill = "#F5F5F5", halign = 0.5, valign = 0.5)) + labs(title = paste0( "<b><span style = 'font-size:20pt'>15% of", "<span style = 'color:#F11B59;'> ", "**Americans Have no Favorite Spectator Sport**", "</span></span></b>", "<br><b><span style = 'font-size:14pt'>", "Share of Answers to **Gallup** question ", "*'What is your favorite sport to watch?'* ", "in 20017", "</span></b><br>") ) + * theme(plot.title = ggtext::element_textbox_simple( * size = 13, * face = NULL, * lineheight = 1.75, * padding = margin(5, 5, 0, 5), * margin = margin(0, 0, 0, 0), * fill = "white")) ``` ]] .column[.content[ ![](ggtext_files/figure-html/ggtext_auto_5_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r # now all the ggtext goodness g + labs(caption = paste0( "#makeovermonday 01/2020 | ", "@ProfDrKSchulte | Inspired by: @barnabasmarkus") ) + theme(plot.caption = ggtext::element_textbox_simple( size = 10, lineheight = 1, padding = margin(10, 10, 10, 10), margin = margin(10, 0, 10, 0), fill = "#F5F5F5", halign = 0.5, valign = 0.5)) + labs(title = paste0( "<b><span style = 'font-size:20pt'>15% of", "<span style = 'color:#F11B59;'> ", "**Americans Have no Favorite Spectator Sport**", "</span></span></b>", "<br><b><span style = 'font-size:14pt'>", "Share of Answers to **Gallup** question ", "*'What is your favorite sport to watch?'* ", "in 20017", "</span></b><br>") ) + theme(plot.title = ggtext::element_textbox_simple( size = 13, face = NULL, lineheight = 1.75, padding = margin(5, 5, 0, 5), margin = margin(0, 0, 0, 0), fill = "white")) + * theme(plot.title.position = "plot") ``` ]] .column[.content[ ![](ggtext_files/figure-html/ggtext_auto_6_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r # now all the ggtext goodness g + labs(caption = paste0( "#makeovermonday 01/2020 | ", "@ProfDrKSchulte | Inspired by: @barnabasmarkus") ) + theme(plot.caption = ggtext::element_textbox_simple( size = 10, lineheight = 1, padding = margin(10, 10, 10, 10), margin = margin(10, 0, 10, 0), fill = "#F5F5F5", halign = 0.5, valign = 0.5)) + labs(title = paste0( "<b><span style = 'font-size:20pt'>15% of", "<span style = 'color:#F11B59;'> ", "**Americans Have no Favorite Spectator Sport**", "</span></span></b>", "<br><b><span style = 'font-size:14pt'>", "Share of Answers to **Gallup** question ", "*'What is your favorite sport to watch?'* ", "in 20017", "</span></b><br>") ) + theme(plot.title = ggtext::element_textbox_simple( size = 13, face = NULL, lineheight = 1.75, padding = margin(5, 5, 0, 5), margin = margin(0, 0, 0, 0), fill = "white")) + theme(plot.title.position = "plot") ``` ]] .column[.content[ ![](ggtext_files/figure-html/ggtext_auto_7_output-1.png)<!-- --> ]] --- Demoing some of what Claus Demoed --- class: split-40 count: false .column[.content[ ```r *library(ggtext) ``` ]] .column[.content[ ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) *iris ``` ]] .column[.content[ ``` Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3.0 1.4 0.2 setosa 3 4.7 3.2 1.3 0.2 setosa 4 4.6 3.1 1.5 0.2 setosa 5 5.0 3.6 1.4 0.2 setosa 6 5.4 3.9 1.7 0.4 setosa 7 4.6 3.4 1.4 0.3 setosa 8 5.0 3.4 1.5 0.2 setosa 9 4.4 2.9 1.4 0.2 setosa 10 4.9 3.1 1.5 0.1 setosa 11 5.4 3.7 1.5 0.2 setosa 12 4.8 3.4 1.6 0.2 setosa 13 4.8 3.0 1.4 0.1 setosa 14 4.3 3.0 1.1 0.1 setosa 15 5.8 4.0 1.2 0.2 setosa 16 5.7 4.4 1.5 0.4 setosa 17 5.4 3.9 1.3 0.4 setosa 18 5.1 3.5 1.4 0.3 setosa 19 5.7 3.8 1.7 0.3 setosa 20 5.1 3.8 1.5 0.3 setosa 21 5.4 3.4 1.7 0.2 setosa 22 5.1 3.7 1.5 0.4 setosa 23 4.6 3.6 1.0 0.2 setosa 24 5.1 3.3 1.7 0.5 setosa 25 4.8 3.4 1.9 0.2 setosa 26 5.0 3.0 1.6 0.2 setosa 27 5.0 3.4 1.6 0.4 setosa 28 5.2 3.5 1.5 0.2 setosa 29 5.2 3.4 1.4 0.2 setosa 30 4.7 3.2 1.6 0.2 setosa 31 4.8 3.1 1.6 0.2 setosa 32 5.4 3.4 1.5 0.4 setosa 33 5.2 4.1 1.5 0.1 setosa 34 5.5 4.2 1.4 0.2 setosa 35 4.9 3.1 1.5 0.2 setosa 36 5.0 3.2 1.2 0.2 setosa 37 5.5 3.5 1.3 0.2 setosa 38 4.9 3.6 1.4 0.1 setosa 39 4.4 3.0 1.3 0.2 setosa 40 5.1 3.4 1.5 0.2 setosa 41 5.0 3.5 1.3 0.3 setosa 42 4.5 2.3 1.3 0.3 setosa 43 4.4 3.2 1.3 0.2 setosa 44 5.0 3.5 1.6 0.6 setosa 45 5.1 3.8 1.9 0.4 setosa 46 4.8 3.0 1.4 0.3 setosa 47 5.1 3.8 1.6 0.2 setosa 48 4.6 3.2 1.4 0.2 setosa 49 5.3 3.7 1.5 0.2 setosa 50 5.0 3.3 1.4 0.2 setosa 51 7.0 3.2 4.7 1.4 versicolor 52 6.4 3.2 4.5 1.5 versicolor 53 6.9 3.1 4.9 1.5 versicolor 54 5.5 2.3 4.0 1.3 versicolor 55 6.5 2.8 4.6 1.5 versicolor 56 5.7 2.8 4.5 1.3 versicolor 57 6.3 3.3 4.7 1.6 versicolor 58 4.9 2.4 3.3 1.0 versicolor 59 6.6 2.9 4.6 1.3 versicolor 60 5.2 2.7 3.9 1.4 versicolor 61 5.0 2.0 3.5 1.0 versicolor 62 5.9 3.0 4.2 1.5 versicolor 63 6.0 2.2 4.0 1.0 versicolor 64 6.1 2.9 4.7 1.4 versicolor 65 5.6 2.9 3.6 1.3 versicolor 66 6.7 3.1 4.4 1.4 versicolor 67 5.6 3.0 4.5 1.5 versicolor 68 5.8 2.7 4.1 1.0 versicolor 69 6.2 2.2 4.5 1.5 versicolor 70 5.6 2.5 3.9 1.1 versicolor 71 5.9 3.2 4.8 1.8 versicolor 72 6.1 2.8 4.0 1.3 versicolor 73 6.3 2.5 4.9 1.5 versicolor 74 6.1 2.8 4.7 1.2 versicolor 75 6.4 2.9 4.3 1.3 versicolor 76 6.6 3.0 4.4 1.4 versicolor 77 6.8 2.8 4.8 1.4 versicolor 78 6.7 3.0 5.0 1.7 versicolor 79 6.0 2.9 4.5 1.5 versicolor 80 5.7 2.6 3.5 1.0 versicolor 81 5.5 2.4 3.8 1.1 versicolor 82 5.5 2.4 3.7 1.0 versicolor 83 5.8 2.7 3.9 1.2 versicolor 84 6.0 2.7 5.1 1.6 versicolor 85 5.4 3.0 4.5 1.5 versicolor 86 6.0 3.4 4.5 1.6 versicolor 87 6.7 3.1 4.7 1.5 versicolor 88 6.3 2.3 4.4 1.3 versicolor 89 5.6 3.0 4.1 1.3 versicolor 90 5.5 2.5 4.0 1.3 versicolor 91 5.5 2.6 4.4 1.2 versicolor 92 6.1 3.0 4.6 1.4 versicolor 93 5.8 2.6 4.0 1.2 versicolor 94 5.0 2.3 3.3 1.0 versicolor 95 5.6 2.7 4.2 1.3 versicolor 96 5.7 3.0 4.2 1.2 versicolor 97 5.7 2.9 4.2 1.3 versicolor 98 6.2 2.9 4.3 1.3 versicolor 99 5.1 2.5 3.0 1.1 versicolor 100 5.7 2.8 4.1 1.3 versicolor 101 6.3 3.3 6.0 2.5 virginica 102 5.8 2.7 5.1 1.9 virginica 103 7.1 3.0 5.9 2.1 virginica 104 6.3 2.9 5.6 1.8 virginica 105 6.5 3.0 5.8 2.2 virginica 106 7.6 3.0 6.6 2.1 virginica 107 4.9 2.5 4.5 1.7 virginica 108 7.3 2.9 6.3 1.8 virginica 109 6.7 2.5 5.8 1.8 virginica 110 7.2 3.6 6.1 2.5 virginica 111 6.5 3.2 5.1 2.0 virginica 112 6.4 2.7 5.3 1.9 virginica 113 6.8 3.0 5.5 2.1 virginica 114 5.7 2.5 5.0 2.0 virginica 115 5.8 2.8 5.1 2.4 virginica 116 6.4 3.2 5.3 2.3 virginica 117 6.5 3.0 5.5 1.8 virginica 118 7.7 3.8 6.7 2.2 virginica 119 7.7 2.6 6.9 2.3 virginica 120 6.0 2.2 5.0 1.5 virginica 121 6.9 3.2 5.7 2.3 virginica 122 5.6 2.8 4.9 2.0 virginica 123 7.7 2.8 6.7 2.0 virginica 124 6.3 2.7 4.9 1.8 virginica 125 6.7 3.3 5.7 2.1 virginica 126 7.2 3.2 6.0 1.8 virginica 127 6.2 2.8 4.8 1.8 virginica 128 6.1 3.0 4.9 1.8 virginica 129 6.4 2.8 5.6 2.1 virginica 130 7.2 3.0 5.8 1.6 virginica 131 7.4 2.8 6.1 1.9 virginica 132 7.9 3.8 6.4 2.0 virginica 133 6.4 2.8 5.6 2.2 virginica 134 6.3 2.8 5.1 1.5 virginica 135 6.1 2.6 5.6 1.4 virginica 136 7.7 3.0 6.1 2.3 virginica 137 6.3 3.4 5.6 2.4 virginica 138 6.4 3.1 5.5 1.8 virginica 139 6.0 3.0 4.8 1.8 virginica 140 6.9 3.1 5.4 2.1 virginica 141 6.7 3.1 5.6 2.4 virginica 142 6.9 3.1 5.1 2.3 virginica 143 5.8 2.7 5.1 1.9 virginica 144 6.8 3.2 5.9 2.3 virginica 145 6.7 3.3 5.7 2.5 virginica 146 6.7 3.0 5.2 2.3 virginica 147 6.3 2.5 5.0 1.9 virginica 148 6.5 3.0 5.2 2.0 virginica 149 6.2 3.4 5.4 2.3 virginica 150 5.9 3.0 5.1 1.8 virginica ``` ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% * mutate(my_var = * glue::glue("*{Species}* (Species)")) ``` ]] .column[.content[ ``` Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3.0 1.4 0.2 setosa 3 4.7 3.2 1.3 0.2 setosa 4 4.6 3.1 1.5 0.2 setosa 5 5.0 3.6 1.4 0.2 setosa 6 5.4 3.9 1.7 0.4 setosa 7 4.6 3.4 1.4 0.3 setosa 8 5.0 3.4 1.5 0.2 setosa 9 4.4 2.9 1.4 0.2 setosa 10 4.9 3.1 1.5 0.1 setosa 11 5.4 3.7 1.5 0.2 setosa 12 4.8 3.4 1.6 0.2 setosa 13 4.8 3.0 1.4 0.1 setosa 14 4.3 3.0 1.1 0.1 setosa 15 5.8 4.0 1.2 0.2 setosa 16 5.7 4.4 1.5 0.4 setosa 17 5.4 3.9 1.3 0.4 setosa 18 5.1 3.5 1.4 0.3 setosa 19 5.7 3.8 1.7 0.3 setosa 20 5.1 3.8 1.5 0.3 setosa 21 5.4 3.4 1.7 0.2 setosa 22 5.1 3.7 1.5 0.4 setosa 23 4.6 3.6 1.0 0.2 setosa 24 5.1 3.3 1.7 0.5 setosa 25 4.8 3.4 1.9 0.2 setosa 26 5.0 3.0 1.6 0.2 setosa 27 5.0 3.4 1.6 0.4 setosa 28 5.2 3.5 1.5 0.2 setosa 29 5.2 3.4 1.4 0.2 setosa 30 4.7 3.2 1.6 0.2 setosa 31 4.8 3.1 1.6 0.2 setosa 32 5.4 3.4 1.5 0.4 setosa 33 5.2 4.1 1.5 0.1 setosa 34 5.5 4.2 1.4 0.2 setosa 35 4.9 3.1 1.5 0.2 setosa 36 5.0 3.2 1.2 0.2 setosa 37 5.5 3.5 1.3 0.2 setosa 38 4.9 3.6 1.4 0.1 setosa 39 4.4 3.0 1.3 0.2 setosa 40 5.1 3.4 1.5 0.2 setosa 41 5.0 3.5 1.3 0.3 setosa 42 4.5 2.3 1.3 0.3 setosa 43 4.4 3.2 1.3 0.2 setosa 44 5.0 3.5 1.6 0.6 setosa 45 5.1 3.8 1.9 0.4 setosa 46 4.8 3.0 1.4 0.3 setosa 47 5.1 3.8 1.6 0.2 setosa 48 4.6 3.2 1.4 0.2 setosa 49 5.3 3.7 1.5 0.2 setosa 50 5.0 3.3 1.4 0.2 setosa 51 7.0 3.2 4.7 1.4 versicolor 52 6.4 3.2 4.5 1.5 versicolor 53 6.9 3.1 4.9 1.5 versicolor 54 5.5 2.3 4.0 1.3 versicolor 55 6.5 2.8 4.6 1.5 versicolor 56 5.7 2.8 4.5 1.3 versicolor 57 6.3 3.3 4.7 1.6 versicolor 58 4.9 2.4 3.3 1.0 versicolor 59 6.6 2.9 4.6 1.3 versicolor 60 5.2 2.7 3.9 1.4 versicolor 61 5.0 2.0 3.5 1.0 versicolor 62 5.9 3.0 4.2 1.5 versicolor 63 6.0 2.2 4.0 1.0 versicolor 64 6.1 2.9 4.7 1.4 versicolor 65 5.6 2.9 3.6 1.3 versicolor 66 6.7 3.1 4.4 1.4 versicolor 67 5.6 3.0 4.5 1.5 versicolor 68 5.8 2.7 4.1 1.0 versicolor 69 6.2 2.2 4.5 1.5 versicolor 70 5.6 2.5 3.9 1.1 versicolor 71 5.9 3.2 4.8 1.8 versicolor 72 6.1 2.8 4.0 1.3 versicolor 73 6.3 2.5 4.9 1.5 versicolor 74 6.1 2.8 4.7 1.2 versicolor 75 6.4 2.9 4.3 1.3 versicolor 76 6.6 3.0 4.4 1.4 versicolor 77 6.8 2.8 4.8 1.4 versicolor 78 6.7 3.0 5.0 1.7 versicolor 79 6.0 2.9 4.5 1.5 versicolor 80 5.7 2.6 3.5 1.0 versicolor 81 5.5 2.4 3.8 1.1 versicolor 82 5.5 2.4 3.7 1.0 versicolor 83 5.8 2.7 3.9 1.2 versicolor 84 6.0 2.7 5.1 1.6 versicolor 85 5.4 3.0 4.5 1.5 versicolor 86 6.0 3.4 4.5 1.6 versicolor 87 6.7 3.1 4.7 1.5 versicolor 88 6.3 2.3 4.4 1.3 versicolor 89 5.6 3.0 4.1 1.3 versicolor 90 5.5 2.5 4.0 1.3 versicolor 91 5.5 2.6 4.4 1.2 versicolor 92 6.1 3.0 4.6 1.4 versicolor 93 5.8 2.6 4.0 1.2 versicolor 94 5.0 2.3 3.3 1.0 versicolor 95 5.6 2.7 4.2 1.3 versicolor 96 5.7 3.0 4.2 1.2 versicolor 97 5.7 2.9 4.2 1.3 versicolor 98 6.2 2.9 4.3 1.3 versicolor 99 5.1 2.5 3.0 1.1 versicolor 100 5.7 2.8 4.1 1.3 versicolor 101 6.3 3.3 6.0 2.5 virginica 102 5.8 2.7 5.1 1.9 virginica 103 7.1 3.0 5.9 2.1 virginica 104 6.3 2.9 5.6 1.8 virginica 105 6.5 3.0 5.8 2.2 virginica 106 7.6 3.0 6.6 2.1 virginica 107 4.9 2.5 4.5 1.7 virginica 108 7.3 2.9 6.3 1.8 virginica 109 6.7 2.5 5.8 1.8 virginica 110 7.2 3.6 6.1 2.5 virginica 111 6.5 3.2 5.1 2.0 virginica 112 6.4 2.7 5.3 1.9 virginica 113 6.8 3.0 5.5 2.1 virginica 114 5.7 2.5 5.0 2.0 virginica 115 5.8 2.8 5.1 2.4 virginica 116 6.4 3.2 5.3 2.3 virginica 117 6.5 3.0 5.5 1.8 virginica 118 7.7 3.8 6.7 2.2 virginica 119 7.7 2.6 6.9 2.3 virginica 120 6.0 2.2 5.0 1.5 virginica 121 6.9 3.2 5.7 2.3 virginica 122 5.6 2.8 4.9 2.0 virginica 123 7.7 2.8 6.7 2.0 virginica 124 6.3 2.7 4.9 1.8 virginica 125 6.7 3.3 5.7 2.1 virginica 126 7.2 3.2 6.0 1.8 virginica 127 6.2 2.8 4.8 1.8 virginica 128 6.1 3.0 4.9 1.8 virginica 129 6.4 2.8 5.6 2.1 virginica 130 7.2 3.0 5.8 1.6 virginica 131 7.4 2.8 6.1 1.9 virginica 132 7.9 3.8 6.4 2.0 virginica 133 6.4 2.8 5.6 2.2 virginica 134 6.3 2.8 5.1 1.5 virginica 135 6.1 2.6 5.6 1.4 virginica 136 7.7 3.0 6.1 2.3 virginica 137 6.3 3.4 5.6 2.4 virginica 138 6.4 3.1 5.5 1.8 virginica 139 6.0 3.0 4.8 1.8 virginica 140 6.9 3.1 5.4 2.1 virginica 141 6.7 3.1 5.6 2.4 virginica 142 6.9 3.1 5.1 2.3 virginica 143 5.8 2.7 5.1 1.9 virginica 144 6.8 3.2 5.9 2.3 virginica 145 6.7 3.3 5.7 2.5 virginica 146 6.7 3.0 5.2 2.3 virginica 147 6.3 2.5 5.0 1.9 virginica 148 6.5 3.0 5.2 2.0 virginica 149 6.2 3.4 5.4 2.3 virginica 150 5.9 3.0 5.1 1.8 virginica my_var 1 *setosa* (Species) 2 *setosa* (Species) 3 *setosa* (Species) 4 *setosa* (Species) 5 *setosa* (Species) 6 *setosa* (Species) 7 *setosa* (Species) 8 *setosa* (Species) 9 *setosa* (Species) 10 *setosa* (Species) 11 *setosa* (Species) 12 *setosa* (Species) 13 *setosa* (Species) 14 *setosa* (Species) 15 *setosa* (Species) 16 *setosa* (Species) 17 *setosa* (Species) 18 *setosa* (Species) 19 *setosa* (Species) 20 *setosa* (Species) 21 *setosa* (Species) 22 *setosa* (Species) 23 *setosa* (Species) 24 *setosa* (Species) 25 *setosa* (Species) 26 *setosa* (Species) 27 *setosa* (Species) 28 *setosa* (Species) 29 *setosa* (Species) 30 *setosa* (Species) 31 *setosa* (Species) 32 *setosa* (Species) 33 *setosa* (Species) 34 *setosa* (Species) 35 *setosa* (Species) 36 *setosa* (Species) 37 *setosa* (Species) 38 *setosa* (Species) 39 *setosa* (Species) 40 *setosa* (Species) 41 *setosa* (Species) 42 *setosa* (Species) 43 *setosa* (Species) 44 *setosa* (Species) 45 *setosa* (Species) 46 *setosa* (Species) 47 *setosa* (Species) 48 *setosa* (Species) 49 *setosa* (Species) 50 *setosa* (Species) 51 *versicolor* (Species) 52 *versicolor* (Species) 53 *versicolor* (Species) 54 *versicolor* (Species) 55 *versicolor* (Species) 56 *versicolor* (Species) 57 *versicolor* (Species) 58 *versicolor* (Species) 59 *versicolor* (Species) 60 *versicolor* (Species) 61 *versicolor* (Species) 62 *versicolor* (Species) 63 *versicolor* (Species) 64 *versicolor* (Species) 65 *versicolor* (Species) 66 *versicolor* (Species) 67 *versicolor* (Species) 68 *versicolor* (Species) 69 *versicolor* (Species) 70 *versicolor* (Species) 71 *versicolor* (Species) 72 *versicolor* (Species) 73 *versicolor* (Species) 74 *versicolor* (Species) 75 *versicolor* (Species) 76 *versicolor* (Species) 77 *versicolor* (Species) 78 *versicolor* (Species) 79 *versicolor* (Species) 80 *versicolor* (Species) 81 *versicolor* (Species) 82 *versicolor* (Species) 83 *versicolor* (Species) 84 *versicolor* (Species) 85 *versicolor* (Species) 86 *versicolor* (Species) 87 *versicolor* (Species) 88 *versicolor* (Species) 89 *versicolor* (Species) 90 *versicolor* (Species) 91 *versicolor* (Species) 92 *versicolor* (Species) 93 *versicolor* (Species) 94 *versicolor* (Species) 95 *versicolor* (Species) 96 *versicolor* (Species) 97 *versicolor* (Species) 98 *versicolor* (Species) 99 *versicolor* (Species) 100 *versicolor* (Species) 101 *virginica* (Species) 102 *virginica* (Species) 103 *virginica* (Species) 104 *virginica* (Species) 105 *virginica* (Species) 106 *virginica* (Species) 107 *virginica* (Species) 108 *virginica* (Species) 109 *virginica* (Species) 110 *virginica* (Species) 111 *virginica* (Species) 112 *virginica* (Species) 113 *virginica* (Species) 114 *virginica* (Species) 115 *virginica* (Species) 116 *virginica* (Species) 117 *virginica* (Species) 118 *virginica* (Species) 119 *virginica* (Species) 120 *virginica* (Species) 121 *virginica* (Species) 122 *virginica* (Species) 123 *virginica* (Species) 124 *virginica* (Species) 125 *virginica* (Species) 126 *virginica* (Species) 127 *virginica* (Species) 128 *virginica* (Species) 129 *virginica* (Species) 130 *virginica* (Species) 131 *virginica* (Species) 132 *virginica* (Species) 133 *virginica* (Species) 134 *virginica* (Species) 135 *virginica* (Species) 136 *virginica* (Species) 137 *virginica* (Species) 138 *virginica* (Species) 139 *virginica* (Species) 140 *virginica* (Species) 141 *virginica* (Species) 142 *virginica* (Species) 143 *virginica* (Species) 144 *virginica* (Species) 145 *virginica* (Species) 146 *virginica* (Species) 147 *virginica* (Species) 148 *virginica* (Species) 149 *virginica* (Species) 150 *virginica* (Species) ``` ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% mutate(my_var = glue::glue("*{Species}* (Species)")) %>% * mutate(my_color = * case_when(Species == "setosa" ~ "#009456", * Species == "versicolor" ~ "#827139", * Species == "virginica" ~ "#938290")) ``` ]] .column[.content[ ``` Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3.0 1.4 0.2 setosa 3 4.7 3.2 1.3 0.2 setosa 4 4.6 3.1 1.5 0.2 setosa 5 5.0 3.6 1.4 0.2 setosa 6 5.4 3.9 1.7 0.4 setosa 7 4.6 3.4 1.4 0.3 setosa 8 5.0 3.4 1.5 0.2 setosa 9 4.4 2.9 1.4 0.2 setosa 10 4.9 3.1 1.5 0.1 setosa 11 5.4 3.7 1.5 0.2 setosa 12 4.8 3.4 1.6 0.2 setosa 13 4.8 3.0 1.4 0.1 setosa 14 4.3 3.0 1.1 0.1 setosa 15 5.8 4.0 1.2 0.2 setosa 16 5.7 4.4 1.5 0.4 setosa 17 5.4 3.9 1.3 0.4 setosa 18 5.1 3.5 1.4 0.3 setosa 19 5.7 3.8 1.7 0.3 setosa 20 5.1 3.8 1.5 0.3 setosa 21 5.4 3.4 1.7 0.2 setosa 22 5.1 3.7 1.5 0.4 setosa 23 4.6 3.6 1.0 0.2 setosa 24 5.1 3.3 1.7 0.5 setosa 25 4.8 3.4 1.9 0.2 setosa 26 5.0 3.0 1.6 0.2 setosa 27 5.0 3.4 1.6 0.4 setosa 28 5.2 3.5 1.5 0.2 setosa 29 5.2 3.4 1.4 0.2 setosa 30 4.7 3.2 1.6 0.2 setosa 31 4.8 3.1 1.6 0.2 setosa 32 5.4 3.4 1.5 0.4 setosa 33 5.2 4.1 1.5 0.1 setosa 34 5.5 4.2 1.4 0.2 setosa 35 4.9 3.1 1.5 0.2 setosa 36 5.0 3.2 1.2 0.2 setosa 37 5.5 3.5 1.3 0.2 setosa 38 4.9 3.6 1.4 0.1 setosa 39 4.4 3.0 1.3 0.2 setosa 40 5.1 3.4 1.5 0.2 setosa 41 5.0 3.5 1.3 0.3 setosa 42 4.5 2.3 1.3 0.3 setosa 43 4.4 3.2 1.3 0.2 setosa 44 5.0 3.5 1.6 0.6 setosa 45 5.1 3.8 1.9 0.4 setosa 46 4.8 3.0 1.4 0.3 setosa 47 5.1 3.8 1.6 0.2 setosa 48 4.6 3.2 1.4 0.2 setosa 49 5.3 3.7 1.5 0.2 setosa 50 5.0 3.3 1.4 0.2 setosa 51 7.0 3.2 4.7 1.4 versicolor 52 6.4 3.2 4.5 1.5 versicolor 53 6.9 3.1 4.9 1.5 versicolor 54 5.5 2.3 4.0 1.3 versicolor 55 6.5 2.8 4.6 1.5 versicolor 56 5.7 2.8 4.5 1.3 versicolor 57 6.3 3.3 4.7 1.6 versicolor 58 4.9 2.4 3.3 1.0 versicolor 59 6.6 2.9 4.6 1.3 versicolor 60 5.2 2.7 3.9 1.4 versicolor 61 5.0 2.0 3.5 1.0 versicolor 62 5.9 3.0 4.2 1.5 versicolor 63 6.0 2.2 4.0 1.0 versicolor 64 6.1 2.9 4.7 1.4 versicolor 65 5.6 2.9 3.6 1.3 versicolor 66 6.7 3.1 4.4 1.4 versicolor 67 5.6 3.0 4.5 1.5 versicolor 68 5.8 2.7 4.1 1.0 versicolor 69 6.2 2.2 4.5 1.5 versicolor 70 5.6 2.5 3.9 1.1 versicolor 71 5.9 3.2 4.8 1.8 versicolor 72 6.1 2.8 4.0 1.3 versicolor 73 6.3 2.5 4.9 1.5 versicolor 74 6.1 2.8 4.7 1.2 versicolor 75 6.4 2.9 4.3 1.3 versicolor 76 6.6 3.0 4.4 1.4 versicolor 77 6.8 2.8 4.8 1.4 versicolor 78 6.7 3.0 5.0 1.7 versicolor 79 6.0 2.9 4.5 1.5 versicolor 80 5.7 2.6 3.5 1.0 versicolor 81 5.5 2.4 3.8 1.1 versicolor 82 5.5 2.4 3.7 1.0 versicolor 83 5.8 2.7 3.9 1.2 versicolor 84 6.0 2.7 5.1 1.6 versicolor 85 5.4 3.0 4.5 1.5 versicolor 86 6.0 3.4 4.5 1.6 versicolor 87 6.7 3.1 4.7 1.5 versicolor 88 6.3 2.3 4.4 1.3 versicolor 89 5.6 3.0 4.1 1.3 versicolor 90 5.5 2.5 4.0 1.3 versicolor 91 5.5 2.6 4.4 1.2 versicolor 92 6.1 3.0 4.6 1.4 versicolor 93 5.8 2.6 4.0 1.2 versicolor 94 5.0 2.3 3.3 1.0 versicolor 95 5.6 2.7 4.2 1.3 versicolor 96 5.7 3.0 4.2 1.2 versicolor 97 5.7 2.9 4.2 1.3 versicolor 98 6.2 2.9 4.3 1.3 versicolor 99 5.1 2.5 3.0 1.1 versicolor 100 5.7 2.8 4.1 1.3 versicolor 101 6.3 3.3 6.0 2.5 virginica 102 5.8 2.7 5.1 1.9 virginica 103 7.1 3.0 5.9 2.1 virginica 104 6.3 2.9 5.6 1.8 virginica 105 6.5 3.0 5.8 2.2 virginica 106 7.6 3.0 6.6 2.1 virginica 107 4.9 2.5 4.5 1.7 virginica 108 7.3 2.9 6.3 1.8 virginica 109 6.7 2.5 5.8 1.8 virginica 110 7.2 3.6 6.1 2.5 virginica 111 6.5 3.2 5.1 2.0 virginica 112 6.4 2.7 5.3 1.9 virginica 113 6.8 3.0 5.5 2.1 virginica 114 5.7 2.5 5.0 2.0 virginica 115 5.8 2.8 5.1 2.4 virginica 116 6.4 3.2 5.3 2.3 virginica 117 6.5 3.0 5.5 1.8 virginica 118 7.7 3.8 6.7 2.2 virginica 119 7.7 2.6 6.9 2.3 virginica 120 6.0 2.2 5.0 1.5 virginica 121 6.9 3.2 5.7 2.3 virginica 122 5.6 2.8 4.9 2.0 virginica 123 7.7 2.8 6.7 2.0 virginica 124 6.3 2.7 4.9 1.8 virginica 125 6.7 3.3 5.7 2.1 virginica 126 7.2 3.2 6.0 1.8 virginica 127 6.2 2.8 4.8 1.8 virginica 128 6.1 3.0 4.9 1.8 virginica 129 6.4 2.8 5.6 2.1 virginica 130 7.2 3.0 5.8 1.6 virginica 131 7.4 2.8 6.1 1.9 virginica 132 7.9 3.8 6.4 2.0 virginica 133 6.4 2.8 5.6 2.2 virginica 134 6.3 2.8 5.1 1.5 virginica 135 6.1 2.6 5.6 1.4 virginica 136 7.7 3.0 6.1 2.3 virginica 137 6.3 3.4 5.6 2.4 virginica 138 6.4 3.1 5.5 1.8 virginica 139 6.0 3.0 4.8 1.8 virginica 140 6.9 3.1 5.4 2.1 virginica 141 6.7 3.1 5.6 2.4 virginica 142 6.9 3.1 5.1 2.3 virginica 143 5.8 2.7 5.1 1.9 virginica 144 6.8 3.2 5.9 2.3 virginica 145 6.7 3.3 5.7 2.5 virginica 146 6.7 3.0 5.2 2.3 virginica 147 6.3 2.5 5.0 1.9 virginica 148 6.5 3.0 5.2 2.0 virginica 149 6.2 3.4 5.4 2.3 virginica 150 5.9 3.0 5.1 1.8 virginica my_var my_color 1 *setosa* (Species) #009456 2 *setosa* (Species) #009456 3 *setosa* (Species) #009456 4 *setosa* (Species) #009456 5 *setosa* (Species) #009456 6 *setosa* (Species) #009456 7 *setosa* (Species) #009456 8 *setosa* (Species) #009456 9 *setosa* (Species) #009456 10 *setosa* (Species) #009456 11 *setosa* (Species) #009456 12 *setosa* (Species) #009456 13 *setosa* (Species) #009456 14 *setosa* (Species) #009456 15 *setosa* (Species) #009456 16 *setosa* (Species) #009456 17 *setosa* (Species) #009456 18 *setosa* (Species) #009456 19 *setosa* (Species) #009456 20 *setosa* (Species) #009456 21 *setosa* (Species) #009456 22 *setosa* (Species) #009456 23 *setosa* (Species) #009456 24 *setosa* (Species) #009456 25 *setosa* (Species) #009456 26 *setosa* (Species) #009456 27 *setosa* (Species) #009456 28 *setosa* (Species) #009456 29 *setosa* (Species) #009456 30 *setosa* (Species) #009456 31 *setosa* (Species) #009456 32 *setosa* (Species) #009456 33 *setosa* (Species) #009456 34 *setosa* (Species) #009456 35 *setosa* (Species) #009456 36 *setosa* (Species) #009456 37 *setosa* (Species) #009456 38 *setosa* (Species) #009456 39 *setosa* (Species) #009456 40 *setosa* (Species) #009456 41 *setosa* (Species) #009456 42 *setosa* (Species) #009456 43 *setosa* (Species) #009456 44 *setosa* (Species) #009456 45 *setosa* (Species) #009456 46 *setosa* (Species) #009456 47 *setosa* (Species) #009456 48 *setosa* (Species) #009456 49 *setosa* (Species) #009456 50 *setosa* (Species) #009456 51 *versicolor* (Species) #827139 52 *versicolor* (Species) #827139 53 *versicolor* (Species) #827139 54 *versicolor* (Species) #827139 55 *versicolor* (Species) #827139 56 *versicolor* (Species) #827139 57 *versicolor* (Species) #827139 58 *versicolor* (Species) #827139 59 *versicolor* (Species) #827139 60 *versicolor* (Species) #827139 61 *versicolor* (Species) #827139 62 *versicolor* (Species) #827139 63 *versicolor* (Species) #827139 64 *versicolor* (Species) #827139 65 *versicolor* (Species) #827139 66 *versicolor* (Species) #827139 67 *versicolor* (Species) #827139 68 *versicolor* (Species) #827139 69 *versicolor* (Species) #827139 70 *versicolor* (Species) #827139 71 *versicolor* (Species) #827139 72 *versicolor* (Species) #827139 73 *versicolor* (Species) #827139 74 *versicolor* (Species) #827139 75 *versicolor* (Species) #827139 76 *versicolor* (Species) #827139 77 *versicolor* (Species) #827139 78 *versicolor* (Species) #827139 79 *versicolor* (Species) #827139 80 *versicolor* (Species) #827139 81 *versicolor* (Species) #827139 82 *versicolor* (Species) #827139 83 *versicolor* (Species) #827139 84 *versicolor* (Species) #827139 85 *versicolor* (Species) #827139 86 *versicolor* (Species) #827139 87 *versicolor* (Species) #827139 88 *versicolor* (Species) #827139 89 *versicolor* (Species) #827139 90 *versicolor* (Species) #827139 91 *versicolor* (Species) #827139 92 *versicolor* (Species) #827139 93 *versicolor* (Species) #827139 94 *versicolor* (Species) #827139 95 *versicolor* (Species) #827139 96 *versicolor* (Species) #827139 97 *versicolor* (Species) #827139 98 *versicolor* (Species) #827139 99 *versicolor* (Species) #827139 100 *versicolor* (Species) #827139 101 *virginica* (Species) #938290 102 *virginica* (Species) #938290 103 *virginica* (Species) #938290 104 *virginica* (Species) #938290 105 *virginica* (Species) #938290 106 *virginica* (Species) #938290 107 *virginica* (Species) #938290 108 *virginica* (Species) #938290 109 *virginica* (Species) #938290 110 *virginica* (Species) #938290 111 *virginica* (Species) #938290 112 *virginica* (Species) #938290 113 *virginica* (Species) #938290 114 *virginica* (Species) #938290 115 *virginica* (Species) #938290 116 *virginica* (Species) #938290 117 *virginica* (Species) #938290 118 *virginica* (Species) #938290 119 *virginica* (Species) #938290 120 *virginica* (Species) #938290 121 *virginica* (Species) #938290 122 *virginica* (Species) #938290 123 *virginica* (Species) #938290 124 *virginica* (Species) #938290 125 *virginica* (Species) #938290 126 *virginica* (Species) #938290 127 *virginica* (Species) #938290 128 *virginica* (Species) #938290 129 *virginica* (Species) #938290 130 *virginica* (Species) #938290 131 *virginica* (Species) #938290 132 *virginica* (Species) #938290 133 *virginica* (Species) #938290 134 *virginica* (Species) #938290 135 *virginica* (Species) #938290 136 *virginica* (Species) #938290 137 *virginica* (Species) #938290 138 *virginica* (Species) #938290 139 *virginica* (Species) #938290 140 *virginica* (Species) #938290 141 *virginica* (Species) #938290 142 *virginica* (Species) #938290 143 *virginica* (Species) #938290 144 *virginica* (Species) #938290 145 *virginica* (Species) #938290 146 *virginica* (Species) #938290 147 *virginica* (Species) #938290 148 *virginica* (Species) #938290 149 *virginica* (Species) #938290 150 *virginica* (Species) #938290 ``` ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% mutate(my_var = glue::glue("*{Species}* (Species)")) %>% mutate(my_color = case_when(Species == "setosa" ~ "#009456", Species == "versicolor" ~ "#827139", Species == "virginica" ~ "#938290")) %>% * select(my_var, my_color, everything()) ``` ]] .column[.content[ ``` my_var my_color Sepal.Length Sepal.Width Petal.Length 1 *setosa* (Species) #009456 5.1 3.5 1.4 2 *setosa* (Species) #009456 4.9 3.0 1.4 3 *setosa* (Species) #009456 4.7 3.2 1.3 4 *setosa* (Species) #009456 4.6 3.1 1.5 5 *setosa* (Species) #009456 5.0 3.6 1.4 6 *setosa* (Species) #009456 5.4 3.9 1.7 7 *setosa* (Species) #009456 4.6 3.4 1.4 8 *setosa* (Species) #009456 5.0 3.4 1.5 9 *setosa* (Species) #009456 4.4 2.9 1.4 10 *setosa* (Species) #009456 4.9 3.1 1.5 11 *setosa* (Species) #009456 5.4 3.7 1.5 12 *setosa* (Species) #009456 4.8 3.4 1.6 13 *setosa* (Species) #009456 4.8 3.0 1.4 14 *setosa* (Species) #009456 4.3 3.0 1.1 15 *setosa* (Species) #009456 5.8 4.0 1.2 16 *setosa* (Species) #009456 5.7 4.4 1.5 17 *setosa* (Species) #009456 5.4 3.9 1.3 18 *setosa* (Species) #009456 5.1 3.5 1.4 19 *setosa* (Species) #009456 5.7 3.8 1.7 20 *setosa* (Species) #009456 5.1 3.8 1.5 21 *setosa* (Species) #009456 5.4 3.4 1.7 22 *setosa* (Species) #009456 5.1 3.7 1.5 23 *setosa* (Species) #009456 4.6 3.6 1.0 24 *setosa* (Species) #009456 5.1 3.3 1.7 25 *setosa* (Species) #009456 4.8 3.4 1.9 26 *setosa* (Species) #009456 5.0 3.0 1.6 27 *setosa* (Species) #009456 5.0 3.4 1.6 28 *setosa* (Species) #009456 5.2 3.5 1.5 29 *setosa* (Species) #009456 5.2 3.4 1.4 30 *setosa* (Species) #009456 4.7 3.2 1.6 31 *setosa* (Species) #009456 4.8 3.1 1.6 32 *setosa* (Species) #009456 5.4 3.4 1.5 33 *setosa* (Species) #009456 5.2 4.1 1.5 34 *setosa* (Species) #009456 5.5 4.2 1.4 35 *setosa* (Species) #009456 4.9 3.1 1.5 36 *setosa* (Species) #009456 5.0 3.2 1.2 37 *setosa* (Species) #009456 5.5 3.5 1.3 38 *setosa* (Species) #009456 4.9 3.6 1.4 39 *setosa* (Species) #009456 4.4 3.0 1.3 40 *setosa* (Species) #009456 5.1 3.4 1.5 41 *setosa* (Species) #009456 5.0 3.5 1.3 42 *setosa* (Species) #009456 4.5 2.3 1.3 43 *setosa* (Species) #009456 4.4 3.2 1.3 44 *setosa* (Species) #009456 5.0 3.5 1.6 45 *setosa* (Species) #009456 5.1 3.8 1.9 46 *setosa* (Species) #009456 4.8 3.0 1.4 47 *setosa* (Species) #009456 5.1 3.8 1.6 48 *setosa* (Species) #009456 4.6 3.2 1.4 49 *setosa* (Species) #009456 5.3 3.7 1.5 50 *setosa* (Species) #009456 5.0 3.3 1.4 51 *versicolor* (Species) #827139 7.0 3.2 4.7 52 *versicolor* (Species) #827139 6.4 3.2 4.5 53 *versicolor* (Species) #827139 6.9 3.1 4.9 54 *versicolor* (Species) #827139 5.5 2.3 4.0 55 *versicolor* (Species) #827139 6.5 2.8 4.6 56 *versicolor* (Species) #827139 5.7 2.8 4.5 57 *versicolor* (Species) #827139 6.3 3.3 4.7 58 *versicolor* (Species) #827139 4.9 2.4 3.3 59 *versicolor* (Species) #827139 6.6 2.9 4.6 60 *versicolor* (Species) #827139 5.2 2.7 3.9 61 *versicolor* (Species) #827139 5.0 2.0 3.5 62 *versicolor* (Species) #827139 5.9 3.0 4.2 63 *versicolor* (Species) #827139 6.0 2.2 4.0 64 *versicolor* (Species) #827139 6.1 2.9 4.7 65 *versicolor* (Species) #827139 5.6 2.9 3.6 66 *versicolor* (Species) #827139 6.7 3.1 4.4 67 *versicolor* (Species) #827139 5.6 3.0 4.5 68 *versicolor* (Species) #827139 5.8 2.7 4.1 69 *versicolor* (Species) #827139 6.2 2.2 4.5 70 *versicolor* (Species) #827139 5.6 2.5 3.9 71 *versicolor* (Species) #827139 5.9 3.2 4.8 72 *versicolor* (Species) #827139 6.1 2.8 4.0 73 *versicolor* (Species) #827139 6.3 2.5 4.9 74 *versicolor* (Species) #827139 6.1 2.8 4.7 75 *versicolor* (Species) #827139 6.4 2.9 4.3 76 *versicolor* (Species) #827139 6.6 3.0 4.4 77 *versicolor* (Species) #827139 6.8 2.8 4.8 78 *versicolor* (Species) #827139 6.7 3.0 5.0 79 *versicolor* (Species) #827139 6.0 2.9 4.5 80 *versicolor* (Species) #827139 5.7 2.6 3.5 81 *versicolor* (Species) #827139 5.5 2.4 3.8 82 *versicolor* (Species) #827139 5.5 2.4 3.7 83 *versicolor* (Species) #827139 5.8 2.7 3.9 84 *versicolor* (Species) #827139 6.0 2.7 5.1 85 *versicolor* (Species) #827139 5.4 3.0 4.5 86 *versicolor* (Species) #827139 6.0 3.4 4.5 87 *versicolor* (Species) #827139 6.7 3.1 4.7 88 *versicolor* (Species) #827139 6.3 2.3 4.4 89 *versicolor* (Species) #827139 5.6 3.0 4.1 90 *versicolor* (Species) #827139 5.5 2.5 4.0 91 *versicolor* (Species) #827139 5.5 2.6 4.4 92 *versicolor* (Species) #827139 6.1 3.0 4.6 93 *versicolor* (Species) #827139 5.8 2.6 4.0 94 *versicolor* (Species) #827139 5.0 2.3 3.3 95 *versicolor* (Species) #827139 5.6 2.7 4.2 96 *versicolor* (Species) #827139 5.7 3.0 4.2 97 *versicolor* (Species) #827139 5.7 2.9 4.2 98 *versicolor* (Species) #827139 6.2 2.9 4.3 99 *versicolor* (Species) #827139 5.1 2.5 3.0 100 *versicolor* (Species) #827139 5.7 2.8 4.1 101 *virginica* (Species) #938290 6.3 3.3 6.0 102 *virginica* (Species) #938290 5.8 2.7 5.1 103 *virginica* (Species) #938290 7.1 3.0 5.9 104 *virginica* (Species) #938290 6.3 2.9 5.6 105 *virginica* (Species) #938290 6.5 3.0 5.8 106 *virginica* (Species) #938290 7.6 3.0 6.6 107 *virginica* (Species) #938290 4.9 2.5 4.5 108 *virginica* (Species) #938290 7.3 2.9 6.3 109 *virginica* (Species) #938290 6.7 2.5 5.8 110 *virginica* (Species) #938290 7.2 3.6 6.1 111 *virginica* (Species) #938290 6.5 3.2 5.1 112 *virginica* (Species) #938290 6.4 2.7 5.3 113 *virginica* (Species) #938290 6.8 3.0 5.5 114 *virginica* (Species) #938290 5.7 2.5 5.0 115 *virginica* (Species) #938290 5.8 2.8 5.1 116 *virginica* (Species) #938290 6.4 3.2 5.3 117 *virginica* (Species) #938290 6.5 3.0 5.5 118 *virginica* (Species) #938290 7.7 3.8 6.7 119 *virginica* (Species) #938290 7.7 2.6 6.9 120 *virginica* (Species) #938290 6.0 2.2 5.0 121 *virginica* (Species) #938290 6.9 3.2 5.7 122 *virginica* (Species) #938290 5.6 2.8 4.9 123 *virginica* (Species) #938290 7.7 2.8 6.7 124 *virginica* (Species) #938290 6.3 2.7 4.9 125 *virginica* (Species) #938290 6.7 3.3 5.7 126 *virginica* (Species) #938290 7.2 3.2 6.0 127 *virginica* (Species) #938290 6.2 2.8 4.8 128 *virginica* (Species) #938290 6.1 3.0 4.9 129 *virginica* (Species) #938290 6.4 2.8 5.6 130 *virginica* (Species) #938290 7.2 3.0 5.8 131 *virginica* (Species) #938290 7.4 2.8 6.1 132 *virginica* (Species) #938290 7.9 3.8 6.4 133 *virginica* (Species) #938290 6.4 2.8 5.6 134 *virginica* (Species) #938290 6.3 2.8 5.1 135 *virginica* (Species) #938290 6.1 2.6 5.6 136 *virginica* (Species) #938290 7.7 3.0 6.1 137 *virginica* (Species) #938290 6.3 3.4 5.6 138 *virginica* (Species) #938290 6.4 3.1 5.5 139 *virginica* (Species) #938290 6.0 3.0 4.8 140 *virginica* (Species) #938290 6.9 3.1 5.4 141 *virginica* (Species) #938290 6.7 3.1 5.6 142 *virginica* (Species) #938290 6.9 3.1 5.1 143 *virginica* (Species) #938290 5.8 2.7 5.1 144 *virginica* (Species) #938290 6.8 3.2 5.9 145 *virginica* (Species) #938290 6.7 3.3 5.7 146 *virginica* (Species) #938290 6.7 3.0 5.2 147 *virginica* (Species) #938290 6.3 2.5 5.0 148 *virginica* (Species) #938290 6.5 3.0 5.2 149 *virginica* (Species) #938290 6.2 3.4 5.4 150 *virginica* (Species) #938290 5.9 3.0 5.1 Petal.Width Species 1 0.2 setosa 2 0.2 setosa 3 0.2 setosa 4 0.2 setosa 5 0.2 setosa 6 0.4 setosa 7 0.3 setosa 8 0.2 setosa 9 0.2 setosa 10 0.1 setosa 11 0.2 setosa 12 0.2 setosa 13 0.1 setosa 14 0.1 setosa 15 0.2 setosa 16 0.4 setosa 17 0.4 setosa 18 0.3 setosa 19 0.3 setosa 20 0.3 setosa 21 0.2 setosa 22 0.4 setosa 23 0.2 setosa 24 0.5 setosa 25 0.2 setosa 26 0.2 setosa 27 0.4 setosa 28 0.2 setosa 29 0.2 setosa 30 0.2 setosa 31 0.2 setosa 32 0.4 setosa 33 0.1 setosa 34 0.2 setosa 35 0.2 setosa 36 0.2 setosa 37 0.2 setosa 38 0.1 setosa 39 0.2 setosa 40 0.2 setosa 41 0.3 setosa 42 0.3 setosa 43 0.2 setosa 44 0.6 setosa 45 0.4 setosa 46 0.3 setosa 47 0.2 setosa 48 0.2 setosa 49 0.2 setosa 50 0.2 setosa 51 1.4 versicolor 52 1.5 versicolor 53 1.5 versicolor 54 1.3 versicolor 55 1.5 versicolor 56 1.3 versicolor 57 1.6 versicolor 58 1.0 versicolor 59 1.3 versicolor 60 1.4 versicolor 61 1.0 versicolor 62 1.5 versicolor 63 1.0 versicolor 64 1.4 versicolor 65 1.3 versicolor 66 1.4 versicolor 67 1.5 versicolor 68 1.0 versicolor 69 1.5 versicolor 70 1.1 versicolor 71 1.8 versicolor 72 1.3 versicolor 73 1.5 versicolor 74 1.2 versicolor 75 1.3 versicolor 76 1.4 versicolor 77 1.4 versicolor 78 1.7 versicolor 79 1.5 versicolor 80 1.0 versicolor 81 1.1 versicolor 82 1.0 versicolor 83 1.2 versicolor 84 1.6 versicolor 85 1.5 versicolor 86 1.6 versicolor 87 1.5 versicolor 88 1.3 versicolor 89 1.3 versicolor 90 1.3 versicolor 91 1.2 versicolor 92 1.4 versicolor 93 1.2 versicolor 94 1.0 versicolor 95 1.3 versicolor 96 1.2 versicolor 97 1.3 versicolor 98 1.3 versicolor 99 1.1 versicolor 100 1.3 versicolor 101 2.5 virginica 102 1.9 virginica 103 2.1 virginica 104 1.8 virginica 105 2.2 virginica 106 2.1 virginica 107 1.7 virginica 108 1.8 virginica 109 1.8 virginica 110 2.5 virginica 111 2.0 virginica 112 1.9 virginica 113 2.1 virginica 114 2.0 virginica 115 2.4 virginica 116 2.3 virginica 117 1.8 virginica 118 2.2 virginica 119 2.3 virginica 120 1.5 virginica 121 2.3 virginica 122 2.0 virginica 123 2.0 virginica 124 1.8 virginica 125 2.1 virginica 126 1.8 virginica 127 1.8 virginica 128 1.8 virginica 129 2.1 virginica 130 1.6 virginica 131 1.9 virginica 132 2.0 virginica 133 2.2 virginica 134 1.5 virginica 135 1.4 virginica 136 2.3 virginica 137 2.4 virginica 138 1.8 virginica 139 1.8 virginica 140 2.1 virginica 141 2.4 virginica 142 2.3 virginica 143 1.9 virginica 144 2.3 virginica 145 2.5 virginica 146 2.3 virginica 147 1.9 virginica 148 2.0 virginica 149 2.3 virginica 150 1.8 virginica ``` ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% mutate(my_var = glue::glue("*{Species}* (Species)")) %>% mutate(my_color = case_when(Species == "setosa" ~ "#009456", Species == "versicolor" ~ "#827139", Species == "virginica" ~ "#938290")) %>% select(my_var, my_color, everything()) -> *prepped ``` ]] .column[.content[ ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% mutate(my_var = glue::glue("*{Species}* (Species)")) %>% mutate(my_color = case_when(Species == "setosa" ~ "#009456", Species == "versicolor" ~ "#827139", Species == "virginica" ~ "#938290")) %>% select(my_var, my_color, everything()) -> prepped *prepped ``` ]] .column[.content[ ``` my_var my_color Sepal.Length Sepal.Width Petal.Length 1 *setosa* (Species) #009456 5.1 3.5 1.4 2 *setosa* (Species) #009456 4.9 3.0 1.4 3 *setosa* (Species) #009456 4.7 3.2 1.3 4 *setosa* (Species) #009456 4.6 3.1 1.5 5 *setosa* (Species) #009456 5.0 3.6 1.4 6 *setosa* (Species) #009456 5.4 3.9 1.7 7 *setosa* (Species) #009456 4.6 3.4 1.4 8 *setosa* (Species) #009456 5.0 3.4 1.5 9 *setosa* (Species) #009456 4.4 2.9 1.4 10 *setosa* (Species) #009456 4.9 3.1 1.5 11 *setosa* (Species) #009456 5.4 3.7 1.5 12 *setosa* (Species) #009456 4.8 3.4 1.6 13 *setosa* (Species) #009456 4.8 3.0 1.4 14 *setosa* (Species) #009456 4.3 3.0 1.1 15 *setosa* (Species) #009456 5.8 4.0 1.2 16 *setosa* (Species) #009456 5.7 4.4 1.5 17 *setosa* (Species) #009456 5.4 3.9 1.3 18 *setosa* (Species) #009456 5.1 3.5 1.4 19 *setosa* (Species) #009456 5.7 3.8 1.7 20 *setosa* (Species) #009456 5.1 3.8 1.5 21 *setosa* (Species) #009456 5.4 3.4 1.7 22 *setosa* (Species) #009456 5.1 3.7 1.5 23 *setosa* (Species) #009456 4.6 3.6 1.0 24 *setosa* (Species) #009456 5.1 3.3 1.7 25 *setosa* (Species) #009456 4.8 3.4 1.9 26 *setosa* (Species) #009456 5.0 3.0 1.6 27 *setosa* (Species) #009456 5.0 3.4 1.6 28 *setosa* (Species) #009456 5.2 3.5 1.5 29 *setosa* (Species) #009456 5.2 3.4 1.4 30 *setosa* (Species) #009456 4.7 3.2 1.6 31 *setosa* (Species) #009456 4.8 3.1 1.6 32 *setosa* (Species) #009456 5.4 3.4 1.5 33 *setosa* (Species) #009456 5.2 4.1 1.5 34 *setosa* (Species) #009456 5.5 4.2 1.4 35 *setosa* (Species) #009456 4.9 3.1 1.5 36 *setosa* (Species) #009456 5.0 3.2 1.2 37 *setosa* (Species) #009456 5.5 3.5 1.3 38 *setosa* (Species) #009456 4.9 3.6 1.4 39 *setosa* (Species) #009456 4.4 3.0 1.3 40 *setosa* (Species) #009456 5.1 3.4 1.5 41 *setosa* (Species) #009456 5.0 3.5 1.3 42 *setosa* (Species) #009456 4.5 2.3 1.3 43 *setosa* (Species) #009456 4.4 3.2 1.3 44 *setosa* (Species) #009456 5.0 3.5 1.6 45 *setosa* (Species) #009456 5.1 3.8 1.9 46 *setosa* (Species) #009456 4.8 3.0 1.4 47 *setosa* (Species) #009456 5.1 3.8 1.6 48 *setosa* (Species) #009456 4.6 3.2 1.4 49 *setosa* (Species) #009456 5.3 3.7 1.5 50 *setosa* (Species) #009456 5.0 3.3 1.4 51 *versicolor* (Species) #827139 7.0 3.2 4.7 52 *versicolor* (Species) #827139 6.4 3.2 4.5 53 *versicolor* (Species) #827139 6.9 3.1 4.9 54 *versicolor* (Species) #827139 5.5 2.3 4.0 55 *versicolor* (Species) #827139 6.5 2.8 4.6 56 *versicolor* (Species) #827139 5.7 2.8 4.5 57 *versicolor* (Species) #827139 6.3 3.3 4.7 58 *versicolor* (Species) #827139 4.9 2.4 3.3 59 *versicolor* (Species) #827139 6.6 2.9 4.6 60 *versicolor* (Species) #827139 5.2 2.7 3.9 61 *versicolor* (Species) #827139 5.0 2.0 3.5 62 *versicolor* (Species) #827139 5.9 3.0 4.2 63 *versicolor* (Species) #827139 6.0 2.2 4.0 64 *versicolor* (Species) #827139 6.1 2.9 4.7 65 *versicolor* (Species) #827139 5.6 2.9 3.6 66 *versicolor* (Species) #827139 6.7 3.1 4.4 67 *versicolor* (Species) #827139 5.6 3.0 4.5 68 *versicolor* (Species) #827139 5.8 2.7 4.1 69 *versicolor* (Species) #827139 6.2 2.2 4.5 70 *versicolor* (Species) #827139 5.6 2.5 3.9 71 *versicolor* (Species) #827139 5.9 3.2 4.8 72 *versicolor* (Species) #827139 6.1 2.8 4.0 73 *versicolor* (Species) #827139 6.3 2.5 4.9 74 *versicolor* (Species) #827139 6.1 2.8 4.7 75 *versicolor* (Species) #827139 6.4 2.9 4.3 76 *versicolor* (Species) #827139 6.6 3.0 4.4 77 *versicolor* (Species) #827139 6.8 2.8 4.8 78 *versicolor* (Species) #827139 6.7 3.0 5.0 79 *versicolor* (Species) #827139 6.0 2.9 4.5 80 *versicolor* (Species) #827139 5.7 2.6 3.5 81 *versicolor* (Species) #827139 5.5 2.4 3.8 82 *versicolor* (Species) #827139 5.5 2.4 3.7 83 *versicolor* (Species) #827139 5.8 2.7 3.9 84 *versicolor* (Species) #827139 6.0 2.7 5.1 85 *versicolor* (Species) #827139 5.4 3.0 4.5 86 *versicolor* (Species) #827139 6.0 3.4 4.5 87 *versicolor* (Species) #827139 6.7 3.1 4.7 88 *versicolor* (Species) #827139 6.3 2.3 4.4 89 *versicolor* (Species) #827139 5.6 3.0 4.1 90 *versicolor* (Species) #827139 5.5 2.5 4.0 91 *versicolor* (Species) #827139 5.5 2.6 4.4 92 *versicolor* (Species) #827139 6.1 3.0 4.6 93 *versicolor* (Species) #827139 5.8 2.6 4.0 94 *versicolor* (Species) #827139 5.0 2.3 3.3 95 *versicolor* (Species) #827139 5.6 2.7 4.2 96 *versicolor* (Species) #827139 5.7 3.0 4.2 97 *versicolor* (Species) #827139 5.7 2.9 4.2 98 *versicolor* (Species) #827139 6.2 2.9 4.3 99 *versicolor* (Species) #827139 5.1 2.5 3.0 100 *versicolor* (Species) #827139 5.7 2.8 4.1 101 *virginica* (Species) #938290 6.3 3.3 6.0 102 *virginica* (Species) #938290 5.8 2.7 5.1 103 *virginica* (Species) #938290 7.1 3.0 5.9 104 *virginica* (Species) #938290 6.3 2.9 5.6 105 *virginica* (Species) #938290 6.5 3.0 5.8 106 *virginica* (Species) #938290 7.6 3.0 6.6 107 *virginica* (Species) #938290 4.9 2.5 4.5 108 *virginica* (Species) #938290 7.3 2.9 6.3 109 *virginica* (Species) #938290 6.7 2.5 5.8 110 *virginica* (Species) #938290 7.2 3.6 6.1 111 *virginica* (Species) #938290 6.5 3.2 5.1 112 *virginica* (Species) #938290 6.4 2.7 5.3 113 *virginica* (Species) #938290 6.8 3.0 5.5 114 *virginica* (Species) #938290 5.7 2.5 5.0 115 *virginica* (Species) #938290 5.8 2.8 5.1 116 *virginica* (Species) #938290 6.4 3.2 5.3 117 *virginica* (Species) #938290 6.5 3.0 5.5 118 *virginica* (Species) #938290 7.7 3.8 6.7 119 *virginica* (Species) #938290 7.7 2.6 6.9 120 *virginica* (Species) #938290 6.0 2.2 5.0 121 *virginica* (Species) #938290 6.9 3.2 5.7 122 *virginica* (Species) #938290 5.6 2.8 4.9 123 *virginica* (Species) #938290 7.7 2.8 6.7 124 *virginica* (Species) #938290 6.3 2.7 4.9 125 *virginica* (Species) #938290 6.7 3.3 5.7 126 *virginica* (Species) #938290 7.2 3.2 6.0 127 *virginica* (Species) #938290 6.2 2.8 4.8 128 *virginica* (Species) #938290 6.1 3.0 4.9 129 *virginica* (Species) #938290 6.4 2.8 5.6 130 *virginica* (Species) #938290 7.2 3.0 5.8 131 *virginica* (Species) #938290 7.4 2.8 6.1 132 *virginica* (Species) #938290 7.9 3.8 6.4 133 *virginica* (Species) #938290 6.4 2.8 5.6 134 *virginica* (Species) #938290 6.3 2.8 5.1 135 *virginica* (Species) #938290 6.1 2.6 5.6 136 *virginica* (Species) #938290 7.7 3.0 6.1 137 *virginica* (Species) #938290 6.3 3.4 5.6 138 *virginica* (Species) #938290 6.4 3.1 5.5 139 *virginica* (Species) #938290 6.0 3.0 4.8 140 *virginica* (Species) #938290 6.9 3.1 5.4 141 *virginica* (Species) #938290 6.7 3.1 5.6 142 *virginica* (Species) #938290 6.9 3.1 5.1 143 *virginica* (Species) #938290 5.8 2.7 5.1 144 *virginica* (Species) #938290 6.8 3.2 5.9 145 *virginica* (Species) #938290 6.7 3.3 5.7 146 *virginica* (Species) #938290 6.7 3.0 5.2 147 *virginica* (Species) #938290 6.3 2.5 5.0 148 *virginica* (Species) #938290 6.5 3.0 5.2 149 *virginica* (Species) #938290 6.2 3.4 5.4 150 *virginica* (Species) #938290 5.9 3.0 5.1 Petal.Width Species 1 0.2 setosa 2 0.2 setosa 3 0.2 setosa 4 0.2 setosa 5 0.2 setosa 6 0.4 setosa 7 0.3 setosa 8 0.2 setosa 9 0.2 setosa 10 0.1 setosa 11 0.2 setosa 12 0.2 setosa 13 0.1 setosa 14 0.1 setosa 15 0.2 setosa 16 0.4 setosa 17 0.4 setosa 18 0.3 setosa 19 0.3 setosa 20 0.3 setosa 21 0.2 setosa 22 0.4 setosa 23 0.2 setosa 24 0.5 setosa 25 0.2 setosa 26 0.2 setosa 27 0.4 setosa 28 0.2 setosa 29 0.2 setosa 30 0.2 setosa 31 0.2 setosa 32 0.4 setosa 33 0.1 setosa 34 0.2 setosa 35 0.2 setosa 36 0.2 setosa 37 0.2 setosa 38 0.1 setosa 39 0.2 setosa 40 0.2 setosa 41 0.3 setosa 42 0.3 setosa 43 0.2 setosa 44 0.6 setosa 45 0.4 setosa 46 0.3 setosa 47 0.2 setosa 48 0.2 setosa 49 0.2 setosa 50 0.2 setosa 51 1.4 versicolor 52 1.5 versicolor 53 1.5 versicolor 54 1.3 versicolor 55 1.5 versicolor 56 1.3 versicolor 57 1.6 versicolor 58 1.0 versicolor 59 1.3 versicolor 60 1.4 versicolor 61 1.0 versicolor 62 1.5 versicolor 63 1.0 versicolor 64 1.4 versicolor 65 1.3 versicolor 66 1.4 versicolor 67 1.5 versicolor 68 1.0 versicolor 69 1.5 versicolor 70 1.1 versicolor 71 1.8 versicolor 72 1.3 versicolor 73 1.5 versicolor 74 1.2 versicolor 75 1.3 versicolor 76 1.4 versicolor 77 1.4 versicolor 78 1.7 versicolor 79 1.5 versicolor 80 1.0 versicolor 81 1.1 versicolor 82 1.0 versicolor 83 1.2 versicolor 84 1.6 versicolor 85 1.5 versicolor 86 1.6 versicolor 87 1.5 versicolor 88 1.3 versicolor 89 1.3 versicolor 90 1.3 versicolor 91 1.2 versicolor 92 1.4 versicolor 93 1.2 versicolor 94 1.0 versicolor 95 1.3 versicolor 96 1.2 versicolor 97 1.3 versicolor 98 1.3 versicolor 99 1.1 versicolor 100 1.3 versicolor 101 2.5 virginica 102 1.9 virginica 103 2.1 virginica 104 1.8 virginica 105 2.2 virginica 106 2.1 virginica 107 1.7 virginica 108 1.8 virginica 109 1.8 virginica 110 2.5 virginica 111 2.0 virginica 112 1.9 virginica 113 2.1 virginica 114 2.0 virginica 115 2.4 virginica 116 2.3 virginica 117 1.8 virginica 118 2.2 virginica 119 2.3 virginica 120 1.5 virginica 121 2.3 virginica 122 2.0 virginica 123 2.0 virginica 124 1.8 virginica 125 2.1 virginica 126 1.8 virginica 127 1.8 virginica 128 1.8 virginica 129 2.1 virginica 130 1.6 virginica 131 1.9 virginica 132 2.0 virginica 133 2.2 virginica 134 1.5 virginica 135 1.4 virginica 136 2.3 virginica 137 2.4 virginica 138 1.8 virginica 139 1.8 virginica 140 2.1 virginica 141 2.4 virginica 142 2.3 virginica 143 1.9 virginica 144 2.3 virginica 145 2.5 virginica 146 2.3 virginica 147 1.9 virginica 148 2.0 virginica 149 2.3 virginica 150 1.8 virginica ``` ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% mutate(my_var = glue::glue("*{Species}* (Species)")) %>% mutate(my_color = case_when(Species == "setosa" ~ "#009456", Species == "versicolor" ~ "#827139", Species == "virginica" ~ "#938290")) %>% select(my_var, my_color, everything()) -> prepped prepped %>% * ggplot() ``` ]] .column[.content[ ![](ggtext_files/figure-html/claus_ggtext_auto_8_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% mutate(my_var = glue::glue("*{Species}* (Species)")) %>% mutate(my_color = case_when(Species == "setosa" ~ "#009456", Species == "versicolor" ~ "#827139", Species == "virginica" ~ "#938290")) %>% select(my_var, my_color, everything()) -> prepped prepped %>% ggplot() + * aes(x = my_var) ``` ]] .column[.content[ ![](ggtext_files/figure-html/claus_ggtext_auto_9_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% mutate(my_var = glue::glue("*{Species}* (Species)")) %>% mutate(my_color = case_when(Species == "setosa" ~ "#009456", Species == "versicolor" ~ "#827139", Species == "virginica" ~ "#938290")) %>% select(my_var, my_color, everything()) -> prepped prepped %>% ggplot() + aes(x = my_var) + * aes(y = Sepal.Width) ``` ]] .column[.content[ ![](ggtext_files/figure-html/claus_ggtext_auto_10_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% mutate(my_var = glue::glue("*{Species}* (Species)")) %>% mutate(my_color = case_when(Species == "setosa" ~ "#009456", Species == "versicolor" ~ "#827139", Species == "virginica" ~ "#938290")) %>% select(my_var, my_color, everything()) -> prepped prepped %>% ggplot() + aes(x = my_var) + aes(y = Sepal.Width) + * geom_boxplot() ``` ]] .column[.content[ ![](ggtext_files/figure-html/claus_ggtext_auto_11_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% mutate(my_var = glue::glue("*{Species}* (Species)")) %>% mutate(my_color = case_when(Species == "setosa" ~ "#009456", Species == "versicolor" ~ "#827139", Species == "virginica" ~ "#938290")) %>% select(my_var, my_color, everything()) -> prepped prepped %>% ggplot() + aes(x = my_var) + aes(y = Sepal.Width) + geom_boxplot() + * geom_jitter(width = .2, * height = 0, * alpha = .5) ``` ]] .column[.content[ ![](ggtext_files/figure-html/claus_ggtext_auto_12_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% mutate(my_var = glue::glue("*{Species}* (Species)")) %>% mutate(my_color = case_when(Species == "setosa" ~ "#009456", Species == "versicolor" ~ "#827139", Species == "virginica" ~ "#938290")) %>% select(my_var, my_color, everything()) -> prepped prepped %>% ggplot() + aes(x = my_var) + aes(y = Sepal.Width) + geom_boxplot() + geom_jitter(width = .2, height = 0, alpha = .5) + * aes(fill = my_color) ``` ]] .column[.content[ ![](ggtext_files/figure-html/claus_ggtext_auto_13_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% mutate(my_var = glue::glue("*{Species}* (Species)")) %>% mutate(my_color = case_when(Species == "setosa" ~ "#009456", Species == "versicolor" ~ "#827139", Species == "virginica" ~ "#938290")) %>% select(my_var, my_color, everything()) -> prepped prepped %>% ggplot() + aes(x = my_var) + aes(y = Sepal.Width) + geom_boxplot() + geom_jitter(width = .2, height = 0, alpha = .5) + aes(fill = my_color) + * scale_fill_identity() ``` ]] .column[.content[ ![](ggtext_files/figure-html/claus_ggtext_auto_14_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% mutate(my_var = glue::glue("*{Species}* (Species)")) %>% mutate(my_color = case_when(Species == "setosa" ~ "#009456", Species == "versicolor" ~ "#827139", Species == "virginica" ~ "#938290")) %>% select(my_var, my_color, everything()) -> prepped prepped %>% ggplot() + aes(x = my_var) + aes(y = Sepal.Width) + geom_boxplot() + geom_jitter(width = .2, height = 0, alpha = .5) + aes(fill = my_color) + scale_fill_identity() + * coord_flip() ``` ]] .column[.content[ ![](ggtext_files/figure-html/claus_ggtext_auto_15_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% mutate(my_var = glue::glue("*{Species}* (Species)")) %>% mutate(my_color = case_when(Species == "setosa" ~ "#009456", Species == "versicolor" ~ "#827139", Species == "virginica" ~ "#938290")) %>% select(my_var, my_color, everything()) -> prepped prepped %>% ggplot() + aes(x = my_var) + aes(y = Sepal.Width) + geom_boxplot() + geom_jitter(width = .2, height = 0, alpha = .5) + aes(fill = my_color) + scale_fill_identity() + coord_flip() + * ggtitle("hello *goodbye*") ``` ]] .column[.content[ ![](ggtext_files/figure-html/claus_ggtext_auto_16_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% mutate(my_var = glue::glue("*{Species}* (Species)")) %>% mutate(my_color = case_when(Species == "setosa" ~ "#009456", Species == "versicolor" ~ "#827139", Species == "virginica" ~ "#938290")) %>% select(my_var, my_color, everything()) -> prepped prepped %>% ggplot() + aes(x = my_var) + aes(y = Sepal.Width) + geom_boxplot() + geom_jitter(width = .2, height = 0, alpha = .5) + aes(fill = my_color) + scale_fill_identity() + coord_flip() + ggtitle("hello *goodbye*") + * theme(plot.title = * element_markdown()) ``` ]] .column[.content[ ![](ggtext_files/figure-html/claus_ggtext_auto_17_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% mutate(my_var = glue::glue("*{Species}* (Species)")) %>% mutate(my_color = case_when(Species == "setosa" ~ "#009456", Species == "versicolor" ~ "#827139", Species == "virginica" ~ "#938290")) %>% select(my_var, my_color, everything()) -> prepped prepped %>% ggplot() + aes(x = my_var) + aes(y = Sepal.Width) + geom_boxplot() + geom_jitter(width = .2, height = 0, alpha = .5) + aes(fill = my_color) + scale_fill_identity() + coord_flip() + ggtitle("hello *goodbye*") + theme(plot.title = element_markdown()) + * theme(axis.text.y = * element_markdown()) ``` ]] .column[.content[ ![](ggtext_files/figure-html/claus_ggtext_auto_18_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% mutate(my_var = glue::glue("*{Species}* (Species)")) %>% mutate(my_color = case_when(Species == "setosa" ~ "#009456", Species == "versicolor" ~ "#827139", Species == "virginica" ~ "#938290")) %>% select(my_var, my_color, everything()) -> prepped prepped %>% ggplot() + aes(x = my_var) + aes(y = Sepal.Width) + geom_boxplot() + geom_jitter(width = .2, height = 0, alpha = .5) + aes(fill = my_color) + scale_fill_identity() + coord_flip() + ggtitle("hello *goodbye*") + theme(plot.title = element_markdown()) + theme(axis.text.y = element_markdown()) + * geom_richtext(data = . %>% * group_by(Species, my_var, my_color) %>% * summarise(the_mean = mean(Sepal.Width)), * aes(y = the_mean, * label = glue::glue( * "*mean* = {the_mean} <br>*mean*<sup>2</sup> = {the_mean^2}")) * ) ``` ]] .column[.content[ ![](ggtext_files/figure-html/claus_ggtext_auto_19_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% mutate(my_var = glue::glue("*{Species}* (Species)")) %>% mutate(my_color = case_when(Species == "setosa" ~ "#009456", Species == "versicolor" ~ "#827139", Species == "virginica" ~ "#938290")) %>% select(my_var, my_color, everything()) -> prepped prepped %>% ggplot() + aes(x = my_var) + aes(y = Sepal.Width) + geom_boxplot() + geom_jitter(width = .2, height = 0, alpha = .5) + aes(fill = my_color) + scale_fill_identity() + coord_flip() + ggtitle("hello *goodbye*") + theme(plot.title = element_markdown()) + theme(axis.text.y = element_markdown()) + geom_richtext(data = . %>% group_by(Species, my_var, my_color) %>% summarise(the_mean = mean(Sepal.Width)), aes(y = the_mean, label = glue::glue( "*mean* = {the_mean} <br>*mean*<sup>2</sup> = {the_mean^2}")) ) -> *g ``` ]] .column[.content[ ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% mutate(my_var = glue::glue("*{Species}* (Species)")) %>% mutate(my_color = case_when(Species == "setosa" ~ "#009456", Species == "versicolor" ~ "#827139", Species == "virginica" ~ "#938290")) %>% select(my_var, my_color, everything()) -> prepped prepped %>% ggplot() + aes(x = my_var) + aes(y = Sepal.Width) + geom_boxplot() + geom_jitter(width = .2, height = 0, alpha = .5) + aes(fill = my_color) + scale_fill_identity() + coord_flip() + ggtitle("hello *goodbye*") + theme(plot.title = element_markdown()) + theme(axis.text.y = element_markdown()) + geom_richtext(data = . %>% group_by(Species, my_var, my_color) %>% summarise(the_mean = mean(Sepal.Width)), aes(y = the_mean, label = glue::glue( "*mean* = {the_mean} <br>*mean*<sup>2</sup> = {the_mean^2}")) ) -> g *g ``` ]] .column[.content[ ![](ggtext_files/figure-html/claus_ggtext_auto_21_output-1.png)<!-- --> ]] --- class: split-40 count: false .column[.content[ ```r library(ggtext) iris %>% mutate(my_var = glue::glue("*{Species}* (Species)")) %>% mutate(my_color = case_when(Species == "setosa" ~ "#009456", Species == "versicolor" ~ "#827139", Species == "virginica" ~ "#938290")) %>% select(my_var, my_color, everything()) -> prepped prepped %>% ggplot() + aes(x = my_var) + aes(y = Sepal.Width) + geom_boxplot() + geom_jitter(width = .2, height = 0, alpha = .5) + aes(fill = my_color) + scale_fill_identity() + coord_flip() + ggtitle("hello *goodbye*") + theme(plot.title = element_markdown()) + theme(axis.text.y = element_markdown()) + geom_richtext(data = . %>% group_by(Species, my_var, my_color) %>% summarise(the_mean = mean(Sepal.Width)), aes(y = the_mean, label = glue::glue( "*mean* = {the_mean} <br>*mean*<sup>2</sup> = {the_mean^2}")) ) -> g g %+% * (prepped %>% * mutate(my_var = * glue::glue("<i style='color:{my_color}'>{Species}</i> ({Species})"))) ``` ]] .column[.content[ ![](ggtext_files/figure-html/claus_ggtext_auto_22_output-1.png)<!-- --> ]] <style type="text/css"> .remark-code{line-height: 1.5; font-size: 55%} </style>