Rain in Sydney

library(emphatic)
sydney_rain |> head(15)
#> # A tibble: 15 × 13
#>     Year   Jan   Feb   Mar   Apr   May   Jun   Jul   Aug   Sep   Oct   Nov   Dec
#>    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#>  1  1960  81.6  85.8  50.4  34.7 123.   96.1 136.   48.2  58.5 290.   68.9 270. 
#>  2  1961  50.9  83.7  56.4 107.   33    47.8  45.6 241.   58    63.1 519.  149. 
#>  3  1962 115.  134.   64.2  57   309     3.3  67.5 133.   82.8  21.5  13.2 133. 
#>  4  1963 120.   84.7 390.  284.  252.  250.   82.8 273.   23.2  67.2  35.6 226. 
#>  5  1964  17.6  31.1 181.   NA    NA    NA    NA    NA    NA    NA    24.2  20.1
#>  6  1965  27.5  11.4   8.2  92.5  55.9 229    83.3  18.9 107.  199.   43.7  64.7
#>  7  1966  26.6 146.  140.  266.   77.3 143.   17.6  82.1  65.4  56.6 191.   92.4
#>  8  1967 180.  156.  127.   47.2  52.8 271.   26.8 198.  105.   84.4  88    53.9
#>  9  1968 132.   13   126.   13.3 108.   30.4  69.9  38.7   1.6   6    19    88.9
#> 10  1969  42.7 231.  108.  152.   59.9 216.   50.8  39.7  81.9  48   275.   36.4
#> 11  1970 153.   58.6  NA    51    10.2  33.9   3.6  40.6 152.   21.9 122.  264. 
#> 12  1971 162.  167.   66.3  65.8 107.   62.8  25.9 123.   70.9   2.3  77.5 133. 
#> 13  1972 348.   99.9 164.   82.5  93.8 130.    6.1  33    13.4 157.   65.8  24.6
#> 14  1973 238.  302.   96.8  91.7  28.5  92.1 116.   92.3  78.1 156.  120.   33.2
#> 15  1974 231.  109.  321.  171.  231.  192.   11   199.   60.2  70.2  40.4  NA

Average monthly rainfall during the period 1960 - 2023

(mean_rain <- mean(unlist(sydney_rain[,-1]), na.rm = TRUE))
#> [1] 103.3679

Floods in NSW

Years in which flooding occurred in New South Wales according to wikipedia

flood_years <- c(1970, 1971, 1984, 1986, 1990, 1996, 1998, 2007, 2012, 2013, 2015, 2016, 2020, 2021, 2022)

Highlight months with above average rainfall and mark years in which flooding occurred

sydney_rain |>
  hl(
    ggplot2::scale_colour_gradient2(na.value = 'white', low = 'white', 
                                    high = 'darkgreen', midpoint = mean_rain), 
    cols = Jan:Dec
  ) |>
  hl('skyblue', rows = Year %in% flood_years, cols = 'Year') |>
  hl_adjust(na = '') |>
  as_svg(height = 1300)
     Year   Jan   Feb   Mar   Apr   May   Jun   Jul   Aug   Sep   Oct   Nov   Dec
1 1960 81.6 85.8 50.4 34.7 123.3 96.1 135.7 48.2 58.5 289.7 68.9 269.8
2 1961 50.9 83.7 56.4 107.4 33.0 47.8 45.6 240.6 58.0 63.1 518.8 149.1
3 1962 115.4 134.5 64.2 57.0 309.0 3.3 67.5 132.8 82.8 21.5 13.2 132.8
4 1963 120.1 84.7 389.7 284.1 252.1 250.3 82.8 272.7 23.2 67.2 35.6 226.5
5 1964 17.6 31.1 180.7 24.2 20.1
6 1965 27.5 11.4 8.2 92.5 55.9 229.0 83.3 18.9 106.8 199.2 43.7 64.7
7 1966 26.6 145.6 140.1 265.9 77.3 143.1 17.6 82.1 65.4 56.6 191.2 92.4
8 1967 179.9 155.5 127.3 47.2 52.8 271.3 26.8 198.4 105.3 84.4 88.0 53.9
9 1968 131.9 13.0 125.8 13.3 108.2 30.4 69.9 38.7 1.6 6.0 19.0 88.9
10 1969 42.7 230.9 108.3 151.6 59.9 215.8 50.8 39.7 81.9 48.0 274.6 36.4
11 1970 153.1 58.6 51.0 10.2 33.9 3.6 40.6 152.3 21.9 121.7 263.9
12 1971 161.8 167.1 66.3 65.8 107.2 62.8 25.9 122.6 70.9 2.3 77.5 133.1
13 1972 347.8 99.9 164.1 82.5 93.8 130.5 6.1 33.0 13.4 157.2 65.8 24.6
14 1973 237.8 301.5 96.8 91.7 28.5 92.1 116.5 92.3 78.1 155.5 119.5 33.2
15 1974 230.8 109.1 320.8 170.8 230.8 192.4 11.0 198.6 60.2 70.2 40.4
16 1975 50.4 144.6 304.0 38.2 27.6 287.5
17 1976 270.1 210.3 299.2 10.8 23.9 132.0 151.2 33.7 94.4 261.3 126.9 29.8
18 1977 111.4 148.6 276.8 30.6 114.7 15.2 17.2 59.0 3.2 13.8 20.6
19 1978 213.2 0.0 278.8 107.0 124.4 286.0 24.8 33.2 78.7 102.9 112.2 86.2
20 1979 119.4 36.4 192.4 25.0 120.3 155.1 14.0 8.3 24.0 42.6 73.1 2.6
21 1980 116.6 92.1 60.6 27.4 156.6 62.0 41.0 5.8 5.4 30.7 50.0 28.8
22 1981 66.4 194.1 43.4 104.2 111.2 76.3 44.2 9.2 1.4 131.2 70.9
23 1982 2.5 28.0 156.9 170.9 25.6 195.1 35.4 18.6 27.2
24 1983 40.6 44.4 286.4 182.8 161.4 91.9 47.5 103.2 44.8 120.8 39.2 103.2
25 1984 184.0 114.4 231.6 109.2 147.9 78.4 153.8 8.7 34.4 51.5 385.4 100.4
26 1985 7.4 58.3 79.0 329.4 133.4 136.0 89.3 31.2 98.8 150.8 87.0 96.6
27 1986 225.8 89.9 23.4 119.8 67.2 13.0 27.8 408.8 45.6 60.2 136.8 13.2
28 1987 101.4 37.6 126.0 61.8 52.8 91.6 145.0 173.6 10.6 234.8 167.0 80.8
29 1988 206.7 93.8 76.4 457.4 83.8 107.0 93.6 72.5 116.2 1.0 142.4 128.2
30 1989 157.4 91.0 155.4 376.0 171.8 269.6 7.0 44.4 1.4 23.2 53.2 124.2
31 1990 67.8 613.4 125.6 310.0 160.0 43.8 75.0 177.4 177.2 41.2 31.8 72.0
32 1991 89.4 53.6 17.4 32.0 144.0 291.2 121.2 4.6 47.2 22.0 30.6 180.5
33 1992 70.2 356.8 78.6 74.7 68.6 114.7 20.2 51.2 14.4 115.3 115.1 144.1
34 1993 63.7 62.0 102.9 63.3 22.5 67.6 110.2 53.0 137.8 61.7 78.4 51.3
35 1994 33.2 109.7 135.3 99.0 34.4 75.3 85.6 49.8 21.6 58.4 52.4 65.9
36 1995 100.0 105.1 171.6 29.2 178.6 158.9 13.7 0.0 223.6 48.6 122.9 50.8
37 1996 130.6 52.0 40.8 55.0 160.4 195.2 56.4 115.0 106.2 23.6 194.7 36.6
38 1997 160.0 28.8 32.8 12.4 235.6 101.5 249.2 25.2 133.2 48.0 40.8 22.6
39 1998 101.2 35.8 33.3 264.8 226.2 151.9 92.6 481.0 46.2 40.5 78.3 78.8
40 1999 158.8 49.0 242.6 91.4 164.2 31.6 161.8 60.4 98.4
41 2000 32.8 47.4 241.6 56.2 58.3 38.2 32.8 26.2 35.0 75.2 141.2 46.0
42 2001 139.2 90.2 122.7 375.6 28.0 146.4 32.8 100.6
43 2002 90.6 377.8 84.8 96.0 117.4 42.0 25.4 22.0 28.4 33.6 71.2
44 2003 11.8 57.8 135.6 217.4 372.0 55.2 89.4 51.0 8.0 76.6 97.0
45 2004 33.6 130.6 89.6 15.0 11.4 60.2 50.2 136.0 74.8 222.6 81.0 74.4
46 2005 119.4 27.6 89.2 1.6 52.2 64.4 108.6 27.4
47 2006 35.2 44.8 43.0 249.2 146.0 96.4 159.2 52.6 103.0
48 2007 55.8 97.1 67.0 266.6 12.4 384.0 54.6 106.2 59.5 25.0 135.8 107.7
49 2008 46.0 275.6 71.0 123.8 7.6 129.8 125.0 63.7 79.4 63.5 88.9
50 2009 146.2 213.7 140.6 64.4 5.6 17.8 140.3 22.9 62.1
51 2010 40.3 262.2 13.4 229.8 143.8 149.6 31.0 41.8 92.8 129.8 45.4
52 2011 72.4 11.4 230.8 180.7 116.2 71.3 282.4 48.5 63.7
53 2012 135.6 182.5 260.1 193.4 40.6 65.0 19.4 24.4 39.4 40.1
54 2013 183.4 170.7 48.0 209.7 77.9 50.6 17.5 76.8 23.8 63.2
55 2014 15.4 89.6 108.8 34.5 13.3 214.8 86.1 18.6 137.1
56 2015 176.2 59.8 60.1 235.3 116.8 130.2 65.5 93.2 107.6 26.3 123.4
57 2016 223.2 54.8 223.4 77.0 10.4 316.2 146.6 130.0 91.2 67.6 20.6 53.0
58 2017 42.0 177.8 227.6 98.8 40.8 166.6 19.8 28.6 0.4 56.0 81.0 80.4
59 2018 41.4 113.8 51.6 30.0 245.6 8.6 10.2 62.2 151.0 93.4
60 2019 45.3 83.4 253.7 14.9 16.5 226.4 50.0 79.6 84.4 28.4 21.1 4.0
61 2020 64.8 431.5 179.4 37.7 148.2 111.6 98.3 30.4 72.5 66.2 111.3
62 2021 87.2 118.4 409.1 35.8 69.3 87.8 44.2 89.7 44.6 53.5 127.0 144.0
63 2022 111.8 398.2 581.9 343.7 211.4 22.8 353.4 75.5 96.0 211.6 67.0 63.3
64 2023 148.5 147.7 64.4 152.4 79.5 16.5 35.2 66.9 22.1 30.1 113.7 24.7