diff --git a/presentations/2023-09-07_coffee_and_coding_functions/browser_screenshot.png b/presentations/2023-09-07_coffee_and_coding_functions/browser_screenshot.png new file mode 100644 index 0000000..0846805 Binary files /dev/null and b/presentations/2023-09-07_coffee_and_coding_functions/browser_screenshot.png differ diff --git a/presentations/2023-09-07_coffee_and_coding_functions/console_screenshot.png b/presentations/2023-09-07_coffee_and_coding_functions/console_screenshot.png new file mode 100644 index 0000000..629552c Binary files /dev/null and b/presentations/2023-09-07_coffee_and_coding_functions/console_screenshot.png differ diff --git a/presentations/2023-09-07_coffee_and_coding_functions/index.qmd b/presentations/2023-09-07_coffee_and_coding_functions/index.qmd new file mode 100644 index 0000000..b76945b --- /dev/null +++ b/presentations/2023-09-07_coffee_and_coding_functions/index.qmd @@ -0,0 +1,389 @@ +--- +title: "Repeating Yourself with Functions" +subtitle: "Coffee and Coding" +author: "[Sally Thompson](mailto:sally.thompson37@nhs.net)" +date: 2023-09-07 +date-format: "DD MMMM YYYY" + +format: + revealjs: + theme: [default, su_presentation.scss] + self-contained: true + transition: none + chalkboard: false + preview-links: auto + slide-number: false + auto-animate: true + width: 1920 + height: 1080 + footer: | + This is my first attempt at a Quarto presentation! + +execute: + echo: true +--- + +```{r setup} +#| echo: false + +library(here) +library(purrr) +library(lubridate) +library(zoo) +library(dplyr) +library(janitor) +library(ggpubr) +library(StrategyUnitTheme) + + +# load data - taken from UDAL +new_rtt <- read.csv("rtt clock starts.csv") |> + clean_names() |> + rename(provider_code = organisation_code, + count = clock_starts) |> + mutate(snapshot_date = dmy(effective_snapshot_date), + rtt_yrmon = as.yearmon(snapshot_date), + rtt_mon = lubridate::month(snapshot_date))|> + select(-c(x, treatment_function_code, effective_snapshot_date, snapshot_date)) |> + mutate(count = case_when(count == 0 ~ 1, + TRUE ~ count)) + +``` + +## Why? + +- Forecasting project, need to do the same thing with data for 6 centres. +- Copy-paste runs risk of not doing the same thing each time (and boring/time-consuming/frustrating). +- Repetition --\> function. + +## What? + +::: columns +::: {.column width="50%"} +Demo with plots, equally applicable to 'doing stuff' with data. + +::: fragment +```{r} + +# preview data +head(new_rtt) +``` +::: +::: + +::: {.column width="50%"} +::: fragment +```{r} +#| echo: false + +p1 <- new_rtt |> + filter(provider_code == "RJE") |> + ggplot(aes(x = rtt_yrmon, y = count)) + + geom_line() + + su_theme() + + theme(legend.position = "none") + + labs(title = "RJE", + subtitle = "time trend of new referrals") + +p2 <- new_rtt |> + filter(provider_code == "RJE") |> + ggplot(aes(x = month(rtt_yrmon), y = count)) + + geom_col() + + su_theme() + + theme(legend.position = "none") + + labs( + subtitle = "monthly pattern of new referrals") + +plots <- ggarrange(p1, p2, nrow = 2) + +``` + +```{r} +#| echo: false +plots +``` + +::: {style="font-size: 0.7em;"} +*Remember, this is about writing functions, not creating stunning visualisations!* +::: +::: + +::: fragment +Repeat this for each of the 6 centres +::: +::: +::: + +## How? + +Do it 'normally' for one centre. What are the parameters to change? + +```{r} +#| output-location: column +#| code-line-numbers: "|2|7|11" + +p1 <- new_rtt |> + filter(provider_code == "RJE") |> + ggplot(aes(x = rtt_yrmon, y = count)) + + geom_line() + + su_theme() + + theme(legend.position = "none") + + labs(title = "RJE", + subtitle = "time trend of new referrals") + +p2 <- new_rtt |> + filter(provider_code == "RJE") |> + ggplot(aes(x = month(rtt_yrmon), y = count)) + + geom_col() + + su_theme() + + theme(legend.position = "none") + + labs( + subtitle = "monthly pattern of new referrals") + +plots <- ggarrange(p1, p2, nrow = 2) + +plots +``` + +::: fragment +This becomes the argument for the function. + +Choose a name for the `argument (!= variable_name)` + +In this example we will use `prov` in place of `"RJE"` +::: + +::: aside +Please remember, this is about writing functions, not creating stunning visualisations! +::: + +## Anatomy of a Function + +```{r} +#| eval: false + +fn_name <- function(arguments){ + + # do stuff + +} + +``` + +Run the function with `fn_name(parameter as argument)` + +## Turning our code into a function + +::: columns +::: {.column width="50%"} +```{r} +#| output: false + +p1 <- new_rtt |> + filter(provider_code == "RJE") |> + ggplot(aes(x = rtt_yrmon, y = count)) + + geom_line() + + su_theme() + + theme(legend.position = "none") + + labs(title = "RJE", + subtitle = "time trend of new referrals") + +p2 <- new_rtt |> + filter(provider_code == "RJE") |> + ggplot(aes(x = month(rtt_yrmon), y = count)) + + geom_col() + + su_theme() + + theme(legend.position = "none") + + labs( + subtitle = "monthly pattern of new referrals") + +plots <- ggarrange(p1, p2, nrow = 2) + +plots + + +``` +::: + +::: {.column width="50%"} +```{r} +#| output: false + +fn_plots <- function(prov){ + + p1 <- new_rtt |> + filter(provider_code == prov) |> + ggplot(aes(x = rtt_yrmon, y = count)) + + geom_line() + + su_theme() + + theme(legend.position = "none") + + labs(title = prov, + subtitle = "time trend of new referrals") + + p2 <- new_rtt |> + filter(provider_code == prov) |> + ggplot(aes(x = month(rtt_yrmon), y = count)) + + geom_col() + + su_theme() + + theme(legend.position = "none") + + labs( + subtitle = "monthly pattern of new referrals") + + plots <- ggarrange(p1, p2, nrow = 2) + + plots + +} +``` +::: +::: + +## Running our function + +::: columns +::: {.column width="50%"} +```{r} + +fn_plots <- function(prov){ + + p1 <- new_rtt |> + filter(provider_code == prov) |> + ggplot(aes(x = rtt_yrmon, y = count)) + + geom_line() + + su_theme() + + theme(legend.position = "none") + + labs(title = prov, + subtitle = "time trend of new referrals") + + p2 <- new_rtt |> + filter(provider_code == prov) |> + ggplot(aes(x = month(rtt_yrmon), y = count)) + + geom_col() + + su_theme() + + theme(legend.position = "none") + + labs( + subtitle = "monthly pattern of new referrals") + + plots <- ggarrange(p1, p2, nrow = 2) + + plots + +} +``` +::: + +::: {.column width="50%"} +```{r} + +fn_plots("RKB") + +``` +::: +::: + +## What if we want more than one argument? + +Easy! Just add them to the arguments when you define the function. + +If I wanted to run this function on multiple dataframes I would change the function to: + +```{r} +#| eval: false + +fn_plots <- function(df, prov){ + + p1 <- df |> + filter(provider_code == prov) + # and the rest as before +} + +``` + +and run it with `fn_plots(new_rtt, "RKB")`. + +Note that the order of entering the parameters is important. If I tried to run `fn_plots("RKB", new_rtt)` it would look for a dataframe called `"RKB"` and a provider called `new_rtt`. + +## Working through a list of parameters {.scrollable} + +Avoid manually running `fn_plots()` for each provider.\ +Use `purrr::map` to iterate over a list + +```{r} +#| output-location: column + +# create a vector of all the providers +prov_labels <- c("RJE", "RKB", "RL4", "RRK", "RWE", "RX1") + +map(prov_labels, ~ fn_plots(.x)) +``` + +## Troubleshooting - does the function work? + +Crawl before you can walk - make sure `fn_plot()` works for one parameter. + +Insert `browser()` into the function while testing - steps into the function (don't forget to remove it when it works!) + +::: columns +::: column +This is a new function that will save each time-trend plot + +```{r} +#| eval: false + +fn_save_plot <- function(prov){ + + p <- new_rtt |> + filter(provider_code == prov) |> + ggplot(aes(x = month(rtt_yrmon), y = count)) + + geom_col() + + su_theme() + + theme(legend.position = "none") + + labs( + subtitle = paste0(prov, " - monthly pattern of new referrals")) + + ggsave(paste0(prov, "_plot.png"), + plot = p) + +} + +``` +::: + +::: column +![](browser_screenshot.png) ![](console_screenshot.png) +::: +::: + +::: aside +Check out [Shannon Pileggi's slides](https://shannonpileggi.github.io/debugging-nhsr) for more options +::: + +## Troubleshooting - does it walk the walk? + +When learning to walk, use `safely()` or `possibly()` in your `walk` function - it will indicate if any parameters have failed, rather than just fall down. + +::: columns +::: column +```{r} +#| eval: false + +# wrap fn_plots in safely +safe_pl <- safely(.f = fn_save_plot) + +map(prov_labels, ~ safe_pl(.x)) + + +# wrap fn_plots in possibly +poss_pl <- possibly(.f = fn_save_plot) + +map(prov_labels, ~ poss_pl(.x)) + +``` +::: + +::: column +Console output of wrapping function in `possibly` + +![](possibly_screenshot.png) +::: +::: diff --git a/presentations/2023-09-07_coffee_and_coding_functions/possibly_screenshot.png b/presentations/2023-09-07_coffee_and_coding_functions/possibly_screenshot.png new file mode 100644 index 0000000..e284127 Binary files /dev/null and b/presentations/2023-09-07_coffee_and_coding_functions/possibly_screenshot.png differ diff --git a/presentations/2023-09-07_coffee_and_coding_functions/rtt clock starts.csv b/presentations/2023-09-07_coffee_and_coding_functions/rtt clock starts.csv new file mode 100644 index 0000000..0a3a35c --- /dev/null +++ b/presentations/2023-09-07_coffee_and_coding_functions/rtt clock starts.csv @@ -0,0 +1,547 @@ +,organisation_code,treatment_function_code,effective_snapshot_date,clock_starts +1,RJE,170,30/11/2015,83 +2,RJE,170,31/12/2015,75 +3,RJE,170,31/01/2016,82 +4,RJE,170,29/02/2016,74 +5,RJE,170,31/03/2016,62 +6,RJE,170,30/04/2016,76 +7,RJE,170,31/05/2016,78 +8,RJE,170,30/06/2016,75 +9,RJE,170,31/07/2016,84 +10,RJE,170,31/08/2016,99 +11,RJE,170,30/09/2016,73 +12,RJE,170,31/10/2016,75 +13,RJE,170,30/11/2016,92 +14,RJE,170,31/12/2016,80 +15,RJE,170,31/01/2017,81 +16,RJE,170,28/02/2017,97 +17,RJE,170,31/03/2017,113 +18,RJE,170,30/04/2017,117 +19,RJE,170,31/05/2017,97 +20,RJE,170,30/06/2017,114 +21,RJE,170,31/07/2017,102 +22,RJE,170,31/08/2017,118 +23,RJE,170,30/09/2017,129 +24,RJE,170,31/10/2017,115 +25,RJE,170,30/11/2017,118 +26,RJE,170,31/12/2017,71 +27,RJE,170,31/01/2018,72 +28,RJE,170,28/02/2018,61 +29,RJE,170,31/03/2018,91 +30,RJE,170,30/04/2018,78 +31,RJE,170,31/05/2018,72 +32,RJE,170,30/06/2018,87 +33,RJE,170,31/07/2018,71 +34,RJE,170,31/08/2018,98 +35,RJE,170,30/09/2018,60 +36,RJE,170,31/10/2018,62 +37,RJE,170,30/11/2018,57 +38,RJE,170,31/12/2018,38 +39,RJE,170,31/01/2019,48 +40,RJE,170,28/02/2019,37 +41,RJE,170,31/03/2019,37 +42,RJE,170,30/04/2019,62 +43,RJE,170,31/05/2019,54 +44,RJE,170,30/06/2019,49 +45,RJE,170,31/07/2019,61 +46,RJE,170,31/08/2019,44 +47,RJE,170,30/09/2019,54 +48,RJE,170,31/10/2019,85 +49,RJE,170,30/11/2019,56 +50,RJE,170,31/12/2019,34 +51,RJE,170,31/01/2020,66 +52,RJE,170,29/02/2020,49 +53,RJE,170,31/03/2020,33 +54,RJE,170,30/04/2020,13 +55,RJE,170,31/05/2020,12 +56,RJE,170,30/06/2020,24 +57,RJE,170,31/07/2020,29 +58,RJE,170,31/08/2020,42 +59,RJE,170,30/09/2020,39 +60,RJE,170,31/10/2020,63 +61,RJE,170,30/11/2020,65 +62,RJE,170,31/12/2020,55 +63,RJE,170,31/01/2021,39 +64,RJE,170,28/02/2021,32 +65,RJE,170,31/03/2021,55 +66,RJE,170,30/04/2021,53 +67,RJE,170,31/05/2021,47 +68,RJE,170,30/06/2021,49 +69,RJE,170,31/07/2021,43 +70,RJE,170,31/08/2021,34 +71,RJE,170,30/09/2021,41 +72,RJE,170,31/10/2021,55 +73,RJE,170,30/11/2021,60 +74,RJE,170,31/12/2021,43 +75,RJE,170,31/01/2022,48 +76,RJE,170,28/02/2022,56 +77,RJE,170,31/03/2022,61 +78,RJE,170,30/04/2022,43 +79,RJE,170,31/05/2022,53 +80,RJE,170,30/06/2022,40 +81,RJE,170,31/07/2022,63 +82,RJE,170,31/08/2022,46 +83,RJE,170,30/09/2022,61 +84,RJE,170,31/10/2022,44 +85,RJE,170,30/11/2022,45 +86,RJE,170,31/12/2022,49 +87,RJE,170,31/01/2023,81 +88,RJE,170,28/02/2023,71 +89,RJE,170,31/03/2023,64 +90,RJE,170,30/04/2023,67 +91,RJE,170,31/05/2023,73 +92,RKB,170,30/11/2015,94 +93,RKB,170,31/12/2015,69 +94,RKB,170,31/01/2016,74 +95,RKB,170,29/02/2016,64 +96,RKB,170,31/03/2016,79 +97,RKB,170,30/04/2016,67 +98,RKB,170,31/05/2016,62 +99,RKB,170,30/06/2016,67 +100,RKB,170,31/07/2016,54 +101,RKB,170,31/08/2016,83 +102,RKB,170,30/09/2016,76 +103,RKB,170,31/10/2016,69 +104,RKB,170,30/11/2016,65 +105,RKB,170,31/12/2016,53 +106,RKB,170,31/01/2017,83 +107,RKB,170,28/02/2017,76 +108,RKB,170,31/03/2017,78 +109,RKB,170,30/04/2017,61 +110,RKB,170,31/05/2017,91 +111,RKB,170,30/06/2017,103 +112,RKB,170,31/07/2017,66 +113,RKB,170,31/08/2017,76 +114,RKB,170,30/09/2017,61 +115,RKB,170,31/10/2017,102 +116,RKB,170,30/11/2017,66 +117,RKB,170,31/12/2017,54 +118,RKB,170,31/01/2018,69 +119,RKB,170,28/02/2018,66 +120,RKB,170,31/03/2018,55 +121,RKB,170,30/04/2018,93 +122,RKB,170,31/05/2018,81 +123,RKB,170,30/06/2018,76 +124,RKB,170,31/07/2018,86 +125,RKB,170,31/08/2018,71 +126,RKB,170,30/09/2018,69 +127,RKB,170,31/10/2018,84 +128,RKB,170,30/11/2018,68 +129,RKB,170,31/12/2018,63 +130,RKB,170,31/01/2019,81 +131,RKB,170,28/02/2019,59 +132,RKB,170,31/03/2019,95 +133,RKB,170,30/04/2019,77 +134,RKB,170,31/05/2019,70 +135,RKB,170,30/06/2019,73 +136,RKB,170,31/07/2019,75 +137,RKB,170,31/08/2019,77 +138,RKB,170,30/09/2019,90 +139,RKB,170,31/10/2019,87 +140,RKB,170,30/11/2019,67 +141,RKB,170,31/12/2019,58 +142,RKB,170,31/01/2020,72 +143,RKB,170,29/02/2020,80 +144,RKB,170,31/03/2020,56 +145,RKB,170,30/04/2020,45 +146,RKB,170,31/05/2020,28 +147,RKB,170,30/06/2020,60 +148,RKB,170,31/07/2020,72 +149,RKB,170,31/08/2020,66 +150,RKB,170,30/09/2020,67 +151,RKB,170,31/10/2020,64 +152,RKB,170,30/11/2020,80 +153,RKB,170,31/12/2020,54 +154,RKB,170,31/01/2021,63 +155,RKB,170,28/02/2021,61 +156,RKB,170,31/03/2021,70 +157,RKB,170,30/04/2021,72 +158,RKB,170,31/05/2021,75 +159,RKB,170,30/06/2021,78 +160,RKB,170,31/07/2021,68 +161,RKB,170,31/08/2021,67 +162,RKB,170,30/09/2021,71 +163,RKB,170,31/10/2021,68 +164,RKB,170,30/11/2021,91 +165,RKB,170,31/12/2021,71 +166,RKB,170,31/01/2022,66 +167,RKB,170,28/02/2022,51 +168,RKB,170,31/03/2022,75 +169,RKB,170,30/04/2022,64 +170,RKB,170,31/05/2022,80 +171,RKB,170,30/06/2022,75 +172,RKB,170,31/07/2022,73 +173,RKB,170,31/08/2022,67 +174,RKB,170,30/09/2022,71 +175,RKB,170,31/10/2022,63 +176,RKB,170,30/11/2022,73 +177,RKB,170,31/12/2022,49 +178,RKB,170,31/01/2023,48 +179,RKB,170,28/02/2023,53 +180,RKB,170,31/03/2023,72 +181,RKB,170,30/04/2023,52 +182,RKB,170,31/05/2023,52 +183,RL4,170,30/11/2015,124 +184,RL4,170,31/12/2015,85 +185,RL4,170,31/01/2016,150 +186,RL4,170,29/02/2016,120 +187,RL4,170,31/03/2016,99 +188,RL4,170,30/04/2016,80 +189,RL4,170,31/05/2016,101 +190,RL4,170,30/06/2016,101 +191,RL4,170,31/07/2016,113 +192,RL4,170,31/08/2016,86 +193,RL4,170,30/09/2016,128 +194,RL4,170,31/10/2016,96 +195,RL4,170,30/11/2016,90 +196,RL4,170,31/12/2016,85 +197,RL4,170,31/01/2017,81 +198,RL4,170,28/02/2017,85 +199,RL4,170,31/03/2017,102 +200,RL4,170,30/04/2017,89 +201,RL4,170,31/05/2017,83 +202,RL4,170,30/06/2017,84 +203,RL4,170,31/07/2017,120 +204,RL4,170,31/08/2017,101 +205,RL4,170,30/09/2017,87 +206,RL4,170,31/10/2017,83 +207,RL4,170,30/11/2017,102 +208,RL4,170,31/12/2017,116 +209,RL4,170,31/01/2018,112 +210,RL4,170,28/02/2018,124 +211,RL4,170,31/03/2018,84 +212,RL4,170,30/04/2018,87 +213,RL4,170,31/05/2018,95 +214,RL4,170,30/06/2018,138 +215,RL4,170,31/07/2018,118 +216,RL4,170,31/08/2018,116 +217,RL4,170,30/09/2018,99 +218,RL4,170,31/10/2018,112 +219,RL4,170,30/11/2018,125 +220,RL4,170,31/12/2018,103 +221,RL4,170,31/01/2019,99 +222,RL4,170,28/02/2019,113 +223,RL4,170,31/03/2019,124 +224,RL4,170,30/04/2019,83 +225,RL4,170,31/05/2019,127 +226,RL4,170,30/06/2019,99 +227,RL4,170,31/07/2019,130 +228,RL4,170,31/08/2019,95 +229,RL4,170,30/09/2019,121 +230,RL4,170,31/10/2019,99 +231,RL4,170,30/11/2019,116 +232,RL4,170,31/12/2019,103 +233,RL4,170,31/01/2020,100 +234,RL4,170,29/02/2020,97 +235,RL4,170,31/03/2020,87 +236,RL4,170,30/04/2020,55 +237,RL4,170,31/05/2020,54 +238,RL4,170,30/06/2020,86 +239,RL4,170,31/07/2020,86 +240,RL4,170,31/08/2020,90 +241,RL4,170,30/09/2020,96 +242,RL4,170,31/10/2020,87 +243,RL4,170,30/11/2020,80 +244,RL4,170,31/12/2020,57 +245,RL4,170,31/01/2021,56 +246,RL4,170,28/02/2021,41 +247,RL4,170,31/03/2021,67 +248,RL4,170,30/04/2021,163 +249,RL4,170,31/05/2021,75 +250,RL4,170,30/06/2021,77 +251,RL4,170,31/07/2021,91 +252,RL4,170,31/08/2021,91 +253,RL4,170,30/09/2021,106 +254,RL4,170,31/10/2021,0 +255,RL4,170,30/11/2021,0 +256,RL4,170,31/12/2021,0 +257,RL4,170,31/01/2022,0 +258,RL4,170,28/02/2022,104 +259,RL4,170,31/03/2022,112 +260,RL4,170,30/04/2022,106 +261,RL4,170,31/05/2022,96 +262,RL4,170,30/06/2022,134 +263,RL4,170,31/07/2022,114 +264,RL4,170,31/08/2022,117 +265,RL4,170,30/09/2022,134 +266,RL4,170,31/10/2022,122 +267,RL4,170,30/11/2022,159 +268,RL4,170,31/12/2022,173 +269,RL4,170,31/01/2023,178 +270,RL4,170,28/02/2023,142 +271,RL4,170,31/03/2023,142 +272,RL4,170,30/04/2023,180 +273,RL4,170,31/05/2023,0 +274,RRK,170,30/11/2015,9 +275,RRK,170,31/12/2015,6 +276,RRK,170,31/01/2016,9 +277,RRK,170,29/02/2016,6 +278,RRK,170,31/03/2016,9 +279,RRK,170,30/04/2016,13 +280,RRK,170,31/05/2016,17 +281,RRK,170,30/06/2016,14 +282,RRK,170,31/07/2016,16 +283,RRK,170,31/08/2016,9 +284,RRK,170,30/09/2016,9 +285,RRK,170,31/10/2016,4 +286,RRK,170,30/11/2016,7 +287,RRK,170,31/12/2016,13 +288,RRK,170,31/01/2017,19 +289,RRK,170,28/02/2017,16 +290,RRK,170,31/03/2017,8 +291,RRK,170,30/04/2017,10 +292,RRK,170,31/05/2017,15 +293,RRK,170,30/06/2017,12 +294,RRK,170,31/07/2017,4 +295,RRK,170,31/08/2017,20 +296,RRK,170,30/09/2017,13 +297,RRK,170,31/10/2017,13 +298,RRK,170,30/11/2017,10 +299,RRK,170,31/12/2017,5 +300,RRK,170,31/01/2018,8 +301,RRK,170,28/02/2018,7 +302,RRK,170,31/03/2018,15 +303,RRK,170,30/04/2018,5 +304,RRK,170,31/05/2018,11 +305,RRK,170,30/06/2018,132 +306,RRK,170,31/07/2018,136 +307,RRK,170,31/08/2018,111 +308,RRK,170,30/09/2018,120 +309,RRK,170,31/10/2018,130 +310,RRK,170,30/11/2018,120 +311,RRK,170,31/12/2018,77 +312,RRK,170,31/01/2019,130 +313,RRK,170,28/02/2019,98 +314,RRK,170,31/03/2019,112 +315,RRK,170,30/04/2019,98 +316,RRK,170,31/05/2019,124 +317,RRK,170,30/06/2019,88 +318,RRK,170,31/07/2019,125 +319,RRK,170,31/08/2019,100 +320,RRK,170,30/09/2019,86 +321,RRK,170,31/10/2019,131 +322,RRK,170,30/11/2019,114 +323,RRK,170,31/12/2019,77 +324,RRK,170,31/01/2020,132 +325,RRK,170,29/02/2020,91 +326,RRK,170,31/03/2020,60 +327,RRK,170,30/04/2020,21 +328,RRK,170,31/05/2020,32 +329,RRK,170,30/06/2020,33 +330,RRK,170,31/07/2020,24 +331,RRK,170,31/08/2020,16 +332,RRK,170,30/09/2020,10 +333,RRK,170,31/10/2020,18 +334,RRK,170,30/11/2020,4 +335,RRK,170,31/12/2020,2 +336,RRK,170,31/01/2021,6 +337,RRK,170,28/02/2021,5 +338,RRK,170,31/03/2021,6 +339,RRK,170,30/04/2021,84 +340,RRK,170,31/05/2021,73 +341,RRK,170,30/06/2021,108 +342,RRK,170,31/07/2021,81 +343,RRK,170,31/08/2021,87 +344,RRK,170,30/09/2021,84 +345,RRK,170,31/10/2021,75 +346,RRK,170,30/11/2021,86 +347,RRK,170,31/12/2021,55 +348,RRK,170,31/01/2022,54 +349,RRK,170,28/02/2022,72 +350,RRK,170,31/03/2022,97 +351,RRK,170,30/04/2022,73 +352,RRK,170,31/05/2022,47 +353,RRK,170,30/06/2022,67 +354,RRK,170,31/07/2022,69 +355,RRK,170,31/08/2022,72 +356,RRK,170,30/09/2022,75 +357,RRK,170,31/10/2022,78 +358,RRK,170,30/11/2022,99 +359,RRK,170,31/12/2022,76 +360,RRK,170,31/01/2023,90 +361,RRK,170,28/02/2023,62 +362,RRK,170,31/03/2023,70 +363,RRK,170,30/04/2023,77 +364,RRK,170,31/05/2023,74 +365,RWE,170,30/11/2015,175 +366,RWE,170,31/12/2015,166 +367,RWE,170,31/01/2016,175 +368,RWE,170,29/02/2016,180 +369,RWE,170,31/03/2016,159 +370,RWE,170,30/04/2016,190 +371,RWE,170,31/05/2016,144 +372,RWE,170,30/06/2016,144 +373,RWE,170,31/07/2016,165 +374,RWE,170,31/08/2016,138 +375,RWE,170,30/09/2016,181 +376,RWE,170,31/10/2016,177 +377,RWE,170,30/11/2016,131 +378,RWE,170,31/12/2016,138 +379,RWE,170,31/01/2017,205 +380,RWE,170,28/02/2017,223 +381,RWE,170,31/03/2017,232 +382,RWE,170,30/04/2017,201 +383,RWE,170,31/05/2017,234 +384,RWE,170,30/06/2017,215 +385,RWE,170,31/07/2017,196 +386,RWE,170,31/08/2017,173 +387,RWE,170,30/09/2017,170 +388,RWE,170,31/10/2017,225 +389,RWE,170,30/11/2017,192 +390,RWE,170,31/12/2017,147 +391,RWE,170,31/01/2018,178 +392,RWE,170,28/02/2018,172 +393,RWE,170,31/03/2018,151 +394,RWE,170,30/04/2018,154 +395,RWE,170,31/05/2018,182 +396,RWE,170,30/06/2018,163 +397,RWE,170,31/07/2018,185 +398,RWE,170,31/08/2018,159 +399,RWE,170,30/09/2018,145 +400,RWE,170,31/10/2018,175 +401,RWE,170,30/11/2018,177 +402,RWE,170,31/12/2018,133 +403,RWE,170,31/01/2019,180 +404,RWE,170,28/02/2019,180 +405,RWE,170,31/03/2019,159 +406,RWE,170,30/04/2019,163 +407,RWE,170,31/05/2019,171 +408,RWE,170,30/06/2019,136 +409,RWE,170,31/07/2019,190 +410,RWE,170,31/08/2019,175 +411,RWE,170,30/09/2019,158 +412,RWE,170,31/10/2019,163 +413,RWE,170,30/11/2019,173 +414,RWE,170,31/12/2019,145 +415,RWE,170,31/01/2020,171 +416,RWE,170,29/02/2020,143 +417,RWE,170,31/03/2020,161 +418,RWE,170,30/04/2020,94 +419,RWE,170,31/05/2020,84 +420,RWE,170,30/06/2020,102 +421,RWE,170,31/07/2020,133 +422,RWE,170,31/08/2020,131 +423,RWE,170,30/09/2020,183 +424,RWE,170,31/10/2020,177 +425,RWE,170,30/11/2020,146 +426,RWE,170,31/12/2020,126 +427,RWE,170,31/01/2021,100 +428,RWE,170,28/02/2021,107 +429,RWE,170,31/03/2021,167 +430,RWE,170,30/04/2021,146 +431,RWE,170,31/05/2021,158 +432,RWE,170,30/06/2021,190 +433,RWE,170,31/07/2021,161 +434,RWE,170,31/08/2021,149 +435,RWE,170,30/09/2021,159 +436,RWE,170,31/10/2021,136 +437,RWE,170,30/11/2021,155 +438,RWE,170,31/12/2021,195 +439,RWE,170,31/01/2022,153 +440,RWE,170,28/02/2022,144 +441,RWE,170,31/03/2022,189 +442,RWE,170,30/04/2022,148 +443,RWE,170,31/05/2022,192 +444,RWE,170,30/06/2022,172 +445,RWE,170,31/07/2022,167 +446,RWE,170,31/08/2022,216 +447,RWE,170,30/09/2022,195 +448,RWE,170,31/10/2022,182 +449,RWE,170,30/11/2022,175 +450,RWE,170,31/12/2022,165 +451,RWE,170,31/01/2023,156 +452,RWE,170,28/02/2023,203 +453,RWE,170,31/03/2023,217 +454,RWE,170,30/04/2023,163 +455,RWE,170,31/05/2023,229 +456,RX1,170,30/11/2015,101 +457,RX1,170,31/12/2015,114 +458,RX1,170,31/01/2016,106 +459,RX1,170,29/02/2016,89 +460,RX1,170,31/03/2016,95 +461,RX1,170,30/04/2016,93 +462,RX1,170,31/05/2016,101 +463,RX1,170,30/06/2016,60 +464,RX1,170,31/07/2016,79 +465,RX1,170,31/08/2016,98 +466,RX1,170,30/09/2016,120 +467,RX1,170,31/10/2016,108 +468,RX1,170,30/11/2016,149 +469,RX1,170,31/12/2016,87 +470,RX1,170,31/01/2017,107 +471,RX1,170,28/02/2017,101 +472,RX1,170,31/03/2017,120 +473,RX1,170,30/04/2017,116 +474,RX1,170,31/05/2017,120 +475,RX1,170,30/06/2017,130 +476,RX1,170,31/07/2017,116 +477,RX1,170,31/08/2017,98 +478,RX1,170,30/09/2017,99 +479,RX1,170,31/10/2017,124 +480,RX1,170,30/11/2017,144 +481,RX1,170,31/12/2017,93 +482,RX1,170,31/01/2018,128 +483,RX1,170,28/02/2018,112 +484,RX1,170,31/03/2018,125 +485,RX1,170,30/04/2018,124 +486,RX1,170,31/05/2018,106 +487,RX1,170,30/06/2018,139 +488,RX1,170,31/07/2018,112 +489,RX1,170,31/08/2018,87 +490,RX1,170,30/09/2018,116 +491,RX1,170,31/10/2018,118 +492,RX1,170,30/11/2018,127 +493,RX1,170,31/12/2018,82 +494,RX1,170,31/01/2019,106 +495,RX1,170,28/02/2019,110 +496,RX1,170,31/03/2019,116 +497,RX1,170,30/04/2019,116 +498,RX1,170,31/05/2019,126 +499,RX1,170,30/06/2019,116 +500,RX1,170,31/07/2019,106 +501,RX1,170,31/08/2019,83 +502,RX1,170,30/09/2019,81 +503,RX1,170,31/10/2019,108 +504,RX1,170,30/11/2019,120 +505,RX1,170,31/12/2019,81 +506,RX1,170,31/01/2020,117 +507,RX1,170,29/02/2020,128 +508,RX1,170,31/03/2020,96 +509,RX1,170,30/04/2020,59 +510,RX1,170,31/05/2020,52 +511,RX1,170,30/06/2020,93 +512,RX1,170,31/07/2020,109 +513,RX1,170,31/08/2020,96 +514,RX1,170,30/09/2020,107 +515,RX1,170,31/10/2020,105 +516,RX1,170,30/11/2020,114 +517,RX1,170,31/12/2020,98 +518,RX1,170,31/01/2021,100 +519,RX1,170,28/02/2021,100 +520,RX1,170,31/03/2021,93 +521,RX1,170,30/04/2021,87 +522,RX1,170,31/05/2021,96 +523,RX1,170,30/06/2021,120 +524,RX1,170,31/07/2021,115 +525,RX1,170,31/08/2021,115 +526,RX1,170,30/09/2021,110 +527,RX1,170,31/10/2021,109 +528,RX1,170,30/11/2021,114 +529,RX1,170,31/12/2021,99 +530,RX1,170,31/01/2022,104 +531,RX1,170,28/02/2022,102 +532,RX1,170,31/03/2022,1394 +533,RX1,170,30/04/2022,112 +534,RX1,170,31/05/2022,118 +535,RX1,170,30/06/2022,141 +536,RX1,170,31/07/2022,123 +537,RX1,170,31/08/2022,129 +538,RX1,170,30/09/2022,118 +539,RX1,170,31/10/2022,129 +540,RX1,170,30/11/2022,147 +541,RX1,170,31/12/2022,120 +542,RX1,170,31/01/2023,143 +543,RX1,170,28/02/2023,84 +544,RX1,170,31/03/2023,131 +545,RX1,170,30/04/2023,94 +546,RX1,170,31/05/2023,133 diff --git a/presentations/2023-09-07_coffee_and_coding_functions/su_presentation.scss b/presentations/2023-09-07_coffee_and_coding_functions/su_presentation.scss new file mode 100644 index 0000000..59c5910 --- /dev/null +++ b/presentations/2023-09-07_coffee_and_coding_functions/su_presentation.scss @@ -0,0 +1,211 @@ +/*-- scss:defaults --*/ +$su-charcoal: #2c2825; +$su-charcoal-l20: lighten($su-charcoal, 20%); +$su-charcoal-l40: lighten($su-charcoal, 40%); +$su-charcoal-l60: lighten($su-charcoal, 60%); +$su-charcoal-l80: lighten($su-charcoal, 80%); + +$su-yellow: #f9bd07; +$su-yellow-l20: lighten($su-yellow, 20%); +$su-yellow-l40: lighten($su-yellow, 40%); +$su-yellow-l60: lighten($su-yellow, 60%); +$su-yellow-l80: lighten($su-yellow, 80%); + +$su-blue: #5881c1; +$su-white: #f5f4f3; +$su-red: #ec6555; +$su-slate: #686f73; + +// load in font awesome icons +@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css"); + + +$body-bg: $su-white; +$body-color: $su-charcoal-l20; +$highlight-color: $su-yellow; +$link-color: $su-blue; +$footer-bg: $su-charcoal; +$footer-fg: $su-yellow; + +$presentation-heading-color: $su-charcoal; + +/*-- scss:rules --*/ + +.reveal .slide blockquote { + border-left: 3px solid $text-muted; + padding-left: 0.6em; + background: #F6F7F7; +} + +.reveal h2 { + padding-bottom: 0.3em; +} + +.reveal .footer { + color: $su-yellow; + background-color: $su-charcoal; + display: block; + position: fixed; + bottom: 0px !important; + padding-bottom: 12px; + padding-top: 12px; + width: 100%; + text-align: center; + font-size: 18px; + z-index: 2; +} + +// need to figure out how to add in :not(.panel-tabset-tabby) +.reveal .slide ul { + li { + list-style: none; + /* Remove default bullets */ + } + + li::before { + content: "\25FC"; + /* Add content: \2022 is the CSS Code/unicode for a bullet; add a space for easier alignment! */ + color: $highlight-color; + /* Change the color */ + display: inline-block; + /* Needed to add space between the bullet and the text */ + width: 1.5em; + /* Also needed for space (tweak if needed) */ + margin-left: -1.5em; + /* Also needed for space (tweak if needed) */ + font-size: 66%; + } +} + +.reveal .progress span { + background-color: $su-yellow; +} + +.reveal .slide-logo { + z-index: 3; + bottom: -5px !important; +} + +.slide-background:first-child { + background-color: $su-charcoal; + background-image: radial-gradient($su-charcoal-l20 1%, transparent 5%); + background-position: 0 0, 10px 10px; + background-size: 30px 30px; + background-repeat: repeat; + height: 100%; + width: 100%; +} + +.slide-background:first-child .slide-background-content { + background-image: url("https://the-strategy-unit.github.io/assets/logo_yellow.svg"); + top: 0.5em; + right: 0.5em; + height: 4em; + width: 4em; + position: absolute; +} + +#title-slide { + text-align: left; +} + +#title-slide h1 { + font-size: 2em; + color: $su-yellow !important; +} + +#title-slide .subtitle { + color: $su-charcoal-l60; +} + +#title-slide .quarto-title-authors { + justify-content: left; + display: block; +} + +#title-slide .quarto-title-author { + padding-top: 1em; + color: $su-red; + padding: 0; +} + +#title-slide .quarto-title-author a { + color: $su-blue; +} + +#title-slide p.institute { + font-size: 0.75em; + color: $su-charcoal-l60; +} + +#title-slide p.date { + font-size: 0.5em; + color: $su-charcoal-l40; +} + +.reveal .slide-logo:first-child { + display: none; +} + +.inverse { + .slide-background-content { + background-color: $su-charcoal; + } + + h1, + h2, + h3, + h4 { + color: $su-charcoal-l40 !important; + } +} + +.reveal .imitate-title { + font-size: 2em; +} + +.reveal .inverse .imitate-title { + color: $su-yellow !important; +} + +.text-bottom { + bottom: 1em; + position: absolute; +} + +.no-bullets ul { + list-style-type: none; + /* Remove bullets */ + padding: 0; + /* Remove padding */ + margin: 0; + /* Remove margins */ +} + +.small-table table { + font-size: 1.65rem; +} + +.small { + font-size: 1.2rem; +} + +.yellow { + color: $su-yellow; +} + +.light-yellow { + color: $su-yellow-l40; +} + +.light-charcoal { + color: $su-charcoal-l40; +} + +.very-light-charcoal { + color: $su-charcoal-l60; +} + +.center { + text-align: center; +} \ No newline at end of file