-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathslides.qmd
1033 lines (642 loc) · 23.3 KB
/
slides.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
format:
revealjs:
logo: presentation/logo.png
code-overflow: wrap
fontsize: 0.9em
incremental: true
css: [presentation/theme/theme.css]
editor: visual
---
## Welcome to Become a Disease Detective ! 🔍 {#TitleSlide data-menu-title="Welcome" background-color="#935d94" style="font-size:80px;padding: 5px "}
Organised by
R Ladies Melbourne
## Acknowledgement of Country {.center}
## We are...
Dionne and Kathleen and we are from
[R Ladies Melbourne]{.purple}.
We are here to teach you how to code in [R]{.purple}!
## What is [coding]{.purple-emph} and what is [R]{.purple-emph} ?
. . .
[Coding]{.purple} is writing instructions that a machine or computer can understand to perform a task.
. . .
::: {style="font-size: 1.5em; fig-align: center;layout-nrow=1"}
![R](presentation/Rlogo.png){width="200"} ![python](presentation/Pythonlogo.png){width="360"} ![java](presentation/JavaLogo.png){width="230"} ![cpp](presentation/cpplogo.png){width="130"}
:::
. . .
[R]{.purple} is coding language used in statistics, data science and many other disciplines. It is also very powerful tool for visualising data.
. . .
## Why should you [learn R]{.purple} ? {.center}
. . .
⚖️ R is free, open source and everyone can access
. . .
\
🥳 It can do so many things
. . .
\
📚 Lots of resources to learn and perform tasks, with a very large user community
. . .
\
🧑🎓 You can get a super cool job ! It's a fantastic skill that is highly sought after in the work force.
## What will you learn today ? {.center}
. . .
\
🗺️ What is an [infectious disease]{.purple}, what is an [outbreak]{.purple} and who are [disease detectives]{.purple}?
. . .
\
🔍 How can [R]{.purple} be used to investigate outbreaks ?
. . .
\
[Then YOU! are going to solve an outbreak !]{.purple-emph}
## What are infectious diseases ?
\
🦠 Infectious diseases are caused by certain microorganisms, such as [bacteria, viruses, parasites or fungi]{.purple-emph}, and will make people (or animals) sick when they are exposed to these microorganisms.
. . .
💭 Most microorganisms don't make us sick, but some do, and these are known as [pathogens]{.purple-emph}.
. . .
🤧 There are lots of different ways that you might get an infectious disease. Some ways include breathing [respiratory droplets]{.purple}, eating [contaminated food or water]{.purple}, insect [bites]{.purple} and many many more !
## When do infectious diseases cause outbreaks ?
📚The [World Health Organisation]{.purple} definition of an [outbreak]{.purple}:
. . .
💡 ["occurence of disease in excess of normal"]{.purple.emph}
. . .
This might be because of a new pathogen, bringing pathogens to new areas, a mutating pathogen.
. . .
\
Many infectious diseases now have vaccines that mean outbreaks to these pathogens occur much less frequently (for example: measles, chicken pox, influenza etc.)
## Let's go through some examples of infectious disease outbreaks: viruses ! {data-menu-title="Examples of infectious diseases !" background-color="#935d94" style="font-size:60px;padding: 5px "}
## The COVID-19 pandemic of 2019
::::: columns
::: {.column width="30%"}
![](presentation/TIME_March2020.png){width="300"}
:::
::: {.column width="70%"}
- The COVID-19 pandemic was caused by a virus known as [SARS-CoV2]{.purple}. It caused a global [pandemic.]{.purple}
- A [pandemic]{.purple} is defined as an infectious disease affecting multiple parts of the world simultaneously, i.e. multiple countries are experiencing an [epidemic]{.purple}
- There are now several vaccines that have helped to reduce the severity of this infection
:::
:::::
## Norovirus Outbreak 2023
::::: columns
::: {.column width="50%"}
![](presentation/norovirus2023.png){width="500"}
:::
::: {.column width="50%"}
- Norovirus causes [vomitting]{.purple} and [diarrhoaea]{.purple} (you might call this gastro)
- It is extremely stable in the environment and highly contagious
- [Ingesting]{.purple} norovirus causes disease
- There is [no vaccine]{.purple} available for norovirus
:::
:::::
## What about bacteria! {data-menu-title="What about bacteria" background-color="#935d94" style="font-size:60px;padding: 5px "}
## Buruli ulcer
::::: columns
::: {.column width="40%"}
![Image: Institut Pasteur](presentation/buruli.jpg){width="500"}
:::
::: {.column width="60%"}
- Buruli ulcer is caused by a bacteria known as [*Mycobacterium ulcerans*]{.purple}
- The bacteria is [slow growing and flesh eating]{.purple} and is [endemic]{.purple} to Melbourne and surrounds
- [Endemic]{.purple} means that there is an ongoing transmission of a pathogen in that area
- Mode of transmission not entirely understood but likely involves [mosquitoes]{.purple} and [possums]{.purple}
:::
:::::
## Who studies outbreaks
- [Public health departments]{.purple} in the government
- How to improve the health of everyone
- [Academic research]{.purple} at Research Institutes and Universities
- Make new discoveries, such as developing new drugs or vaccines
- [Doctors]{.purple} and [health staff]{.purple}
- Keep their patients safe
. . .
And many others too !
##
An [epidemiologist]{.purple} is someone who studies how...
. . .
\
"to keep the public informed on different public health issues and offer solutions to keep communities safe. They perform studies on outbreaks, their causes, transmission and effect on the public, collating that information into accessible data and health recommendations."
Source: [What is epidemiology and what does an epidemiologist do?](https://online.monash.edu/news/what-is-epidemiology-what-does-an-epidemiologist-do/)
## What do we need to know about outbreaks
::::: columns
::: {.column width="60%"}
- What is the problem ?
- What is the cause?
- What can we do to make the situation better ?
:::
::: {.column width="40%"}
:::
:::::
# You are a [disease detective]{.purple-emph} for today and you must help us solve a mysterious outbreak !
## The situation
Unknown illness causes students to [fall ill]{.purple} at local school.
*Local authorities are unsure of the cause of this outbreak, but it appears to be linked to a recent excursion to Melbourne CBD*
## The [excursion]{.purple}
A few days earlier, students at a local school went into Melbourne to see an exhibition at the National Gallery of Victoria.
\
🚌 At 8am, they took the bus to the NGV.
. . .
🎨 They were in the gallery from 9am - 12pm.
. . .
🍲 They had lunch from 12pm - 2pm at three different locations
. . .
🧑🎨 They went back to the gallery for another exhibition between 2 -4 pm
. . .
🏡 At 4pm they were back on the bus to go home
## You are here to investigate...
And you have been given some information including:
::: {.column width="50%"}
- Name
- Class
- Age
- Sex
:::
- Height
- Weight
- Was the student feeling sick
- What were their symptoms
. . .
[And we are going to do this in R !]{.purple-emph}
# Let's learn some basics {background-color="#935d94"}
## R can be our [calculator]{.purple}
. . .
Addition (use [+]{.purple})
```{r addition}
#| echo: true
#| output-location: column-fragment
2+2
```
. . .
Multiplication (use [\*]{.purple})
```{r multiplication}
#| echo: true
#| output-location: column-fragment
2*6
```
. . .
Division (use [/]{.purple})
```{r division}
#| echo: true
#| output-location: column-fragment
150/3
```
. . .
...anything is possible
```{r more complicated}
#| echo: true
#| output-location: column-fragment
((2+3)*8)/123
```
. . .
## Now [you try]{.purple} some basic maths {.center}
Type in your numbers either within the `workshop.R` file or within the `console`.
. . .
Then to run - click `Run` at the top of the `.R` script or type `ctrl/cmd` + `enter`
. . .
The answer prints in the `console`
## What does RStudio look like?
![](presentation/RStudio.png)
## R can be our [notebook]{.purple}
We can [save]{.purple} important information for later.\
We can use `<-` or `=`\
```{r assign1}
#| echo: true
#| output-location: fragment
#| code-line-numbers: "1|2"
my_name <- "Joy"
paste("My name is", my_name)
```
\
. . .
```{r assign2}
#| echo: true
#| output-location: fragment
#| code-line-numbers: "1|2"
several_names <- c("Joy", "Anger", "Sadness")
paste("My name is", several_names)
```
. . .
[Your turn !]{.purple}\
## The same goes for [numbers]{.purple}
```{r assign3}
#| echo: true
#| output-location: fragment
#| code-line-numbers: "1|2|4"
a_number <- 137
another_number <- 120
a_number * another_number
```
\
. . .
```{r assign4}
#| echo: true
#| output-location: fragment
a_number / another_number
```
\
. . .
```{r assign5}
#| echo: true
#| output-location: fragment
(2*a_number) + another_number
```
. . .
Try saving a number or a word to a meaningful name - can you see where it goes?
## Now to solve an outbreak ! {data-menu-title="Welcome" background-color="#935d94" style="font-size:80px;padding: 5px "}
## Where to start?
First we need to load in the data and some tools that are going to help us.
```{r}
#| include: false
#| echo: false
# outbreak_data <- read.table("https://raw.githubusercontent.com/shaziaruybal/2022-05-04-It-takes-a-spark/master/data/Data.txt",
# header = T,
# stringsAsFactors = T)
#
# outbreak_data <- outbreak_data %>%
# janitor::clean_names() %>%
# select(-dizziness_1) %>%
# pivot_longer(-c(firstname, class, height, weight, age, sex, temperature)) %>%
# mutate(value = ifelse(value=="N", "no", "yes")) %>%
# pivot_wider(names_from = "name", values_from = "value")
#
#
# write.csv(outbreak_data, here::here("outbreak_data.csv"),row.names = F)
```
```{r script1}
source(here::here("setup/setup.R"))
```
One of the great things about R is that there are lots of pre-installed commands that we can access or ones that others help to create and we can access. These are our packages that we access with the `library()` command.
## What is `outbreak_data`?
💡The number one step in data analysis is looking at the data
::: notes
Potentially highlight analogies here like reading a full recipe and seeing what ingredients you have or need to buy
:::
. . .
For this, we are going to use our first pre-installed command called `colnames()`.
. . .
```{r colnames}
#| echo: true
#| output-location: fragment
colnames(outbreak_data)
```
. . .
❓Can you find `outbreak_data` in the environment pane?
. . .
🧐 What happens if you click on it there?
## Different kinds of data
In `outbreak_data` we have several kinds of information and it's important to identify what these are !
. . .
- How would you describe what data we have in `Firstname`?
- How is this different to `Weight` ?
- What are some terms we could use to define these ?
## Visualising data
The types of data we have to work with will determine how it is best to visualise !
::::: columns
::: {.column width="45%"}
A [scatter plot]{.purple}
```{r scatter plot}
#this figure is an echo F so code doesn't appear in slides
mpg %>%
ggplot(aes(x = displ, y = cty)) +
geom_point(size = 3)+
labs(y = "", x = "")
```
[Notice both the x and the y-axis are things we can count or measure.]{style="font-size:30px;padding: 5px"}
:::
::: {.column width="45%"}
A [boxplot]{.purple}
```{r boxplot}
#this figure is an echo F so code doesn't appear in slides
mpg %>%
ggplot(aes(x = class, y = cty)) +
geom_boxplot()+
labs(y = "", x = "")
```
[Notice the y-axis are things we count or measure but the x-axis are specific groups.]{style="font-size:30px;padding: 5px"}
:::
:::::
## Let's plot our `outbreak_data`
We will be using a function called `ggplot()`. This is a fantastic tool we can use to make amazing graphs !
Like any graph we need to decide:
1. What do we want on the x-axis?
2. What do we want on the y-axis?
3. What kind of graph do we want to make?
. . .
🧑🎨other ideas like colour, design, groups ... we'll get to this later !
## How to ask ggplot to plot `outbreak_data`
`aes` is referring to [aesthetics]{.purple}, these are all the things we are going to customise.
. . .
```{r ggplot start, fig.align='center', fig.width=7, fig.height=3}
#| echo: true
ggplot(data = outbreak_data,
aes(x = class, y = height))
```
. . .
[Next we choose what kind of graph we need]{.purple}
## We can use `geom_point()` or `geom_boxplot()`
. . .
Let's first try `geom_point()`.
We use the `+` sign to add it to our first ggplot command
. . .
```{r scatter1, fig.width=8, fig.height=4, fig.align='center'}
#| echo: true
#| output-location: slide
#| code-line-numbers: "3"
ggplot(data = outbreak_data,
aes(x = class, y = height))+
geom_point()
```
. . .
Where would we put `geom_boxplot()` ?
## Now swap [height]{.purple} for [temperature]{.purple} on the y-axis
. . .
```{r scatter_temp, fig.width=7, fig.height=4, fig.align='center'}
#| echo: true
#| output-location: fragment
#| code-line-numbers: "2"
ggplot(data = outbreak_data,
aes(x = class, y = temperature))+
geom_point()
```
## Let's [customise !]{.purple}
Can you change size, shape and colour...what kinds of plots can you make ?
```{r scatter_custom}
#| echo: true
#| output-location: slide
#| code-line-numbers: "3"
ggplot(data = outbreak_data,
aes(x = class, y = temperature))+
geom_point(size = 4, shape = 5, colour = "blue")
```
## Can you make a **boxplot** with **class** on the x-axis and **temperature** on the y-axis {data-menu-title="challenge 1" background-color="#935d94" style="font-size:70px;padding: 5px "}
## A boxplot summarising [temperature]{.purple} in the four [classes]{.purple}
```{r boxplot_temp, fig.width=7, fig.height=4, fig.align='center'}
#| echo: true
#| output-location: fragment
#| code-line-numbers: "3"
ggplot(data = outbreak_data,
aes(x = class, y = temperature))+
geom_boxplot()
```
## What does a boxplot tell us ?
- Provides us with an informative summary of the data in our groups
- The center line gives the median
- the box below is 25% of the data below the median and the box below is 25% of the data above
. . .
🧐 If we don't know what R is doing, we can always get [help !]{.purple}
. . .
```{r help}
#| echo: true
?geom_boxplot()
```
## How can we use fill to learn more ?
The `fill` can be specified as [aesthetics]{.purple} like the x and y axis.
. . .
Can you specify the `fill` with our `Sickness` information about each student ?
. . .
```{r boxplot_temp_sick, fig.width=8, fig.height=3.5, fig.align='center'}
#| echo: true
#| output-location: fragment
#| code-line-numbers: "2"
ggplot(data = outbreak_data,
aes(x = class, y = temperature, fill = sickness))+
geom_boxplot()
```
## 🧐 What does temperature tell us about how the students were feeling? {data-menu-title="Are the students feeling sick ?" background-color="#935d94" style="font-size:70px;padding: 5px "}
::: notes
- Were the temperatures the same for students who were sick and those who weren't
- Where the sick students in all classes
- Why do people get a temperature when they get sick?
:::
## Time to give our plot a [title]{.purple}
```{r add_title, fig.align='center'}
#| echo: true
#| output-location: fragment
ggplot(data = outbreak_data,
aes(x = class, y = temperature, fill = sickness))+
geom_boxplot()+
labs(title = "Make a title here !")
```
::: notes
Make it something informative that describes the plot you've just made and why people would be interested to look at it
:::
## Let's calculate some summaries
This symbol `%>%` is used to send our data into another command such as `summarise()`
. . .
As the name would suggest, we can generate summaries, such as calculating the [median]{.purple}
. . .
```{r summarise}
#| echo: true
#| output-location: fragment
outbreak_data %>%
summarise(median = median(temperature))
```
<!-- ## We can make [smaller groups]{.purple} -->
<!-- This is like how we put the `Class` groups on the x-axis of our plot from earlier, and saw the [median]{.purple} was different in each class -->
<!-- . . . -->
<!-- Let's try first to calculate the [median]{.purple} `Temperature` of the four `Classes` -->
<!-- . . . -->
<!-- We will use the `group_by()` command to do this as well as the `median()` command -->
<!-- . . . -->
<!-- ```{r } -->
<!-- #| echo: true -->
<!-- #| output-location: fragment -->
<!-- #| code-line-numbers: "2|3" -->
<!-- outbreak_data %>% -->
<!-- group_by(Class) %>% -->
<!-- summarise(median = median(Temperature)) -->
<!-- ``` -->
## We can also use `group_by()` with multiple groups
. . .
Just like our boxplot, we want to know the median temperature of the students, grouped by their `Class` and `Sickness` status
. . .
👏Try to do this by adding `group_by(class, sickness)`
. . .
```{r summarise_median}
#| echo: true
#| output-location: slide
outbreak_data %>%
group_by(class, sickness) %>%
summarise(median = median(temperature))
```
. . .
How can we relate this to the boxplot we made earlier ?
## Let's focus on the student's symptoms {.purple}
We are going to use a new type of graph to do this, it's called a [bar plot]{.purple}.
. . .
For this we use `geom_bar()`
```{r barchart1, fig.width=6, fig.height=3, fig.align='center'}
#| echo: true
#| output-location: fragment
#| code-line-numbers: "2|3"
ggplot(data = outbreak_data,
aes(x = sickness))+
geom_bar()
```
## How many students were and were not sick ?
As well as the bar plot, we can also use the `count()` command
. . .
```{r count, fig.align='center'}
#| echo: true
#| output-location: fragment
#| code-line-numbers: "2"
outbreak_data %>%
count(sickness)
```
## What is making the students sick ?
Sickness summarises all of the symptoms. Now it's time to get specific!
. . .
Can you make some other bar plots to see what the students were sick with?
. . .
💡 Remember we can use `colnames(outbreak_data)` to find out what information we have in `outbreak_data` ! . . .
🤩 You might also like to try customising your plot. Remember we can change the colour by specifying `fill =` within the `geom_bar()` command. You might also like to try `aes(fill = )`.
## Shortness of breath
```{r shortness_breath, fig.width=7, fig.height=4, fig.align='center'}
#| echo: true
#| output-location: fragment
ggplot(data = outbreak_data,
aes(x = shortness_of_breath))+
geom_bar(aes(fill = shortness_of_breath))
```
## 🧐 What have you found? What symptoms are the most common ? {data-menu-title="Are the students feeling sick ?" background-color="#935d94" style="font-size:70px;padding: 5px "}
## Reorganising our symptoms data
Data can be formatted in different ways.
For example, prioritise having one row per individual with lots of columns
. . .
This is like our `outbreak_data`
. . .
Or sometimes we can change the format and so instead we have a long list of one observation per row.
. . .
This is what we have in our `symptoms` data.
. . .
For the next few plots we are going to use `symptoms` and not `outbreak_data`, however they record exactly the same thing
## Bringing all the symptoms together
```{r symptoms_all, fig.width=7, fig.height=4, fig.align='center'}
#| echo: true
#| output-location: fragment
ggplot(data = symptoms,
aes(y = symptom, fill = status))+
geom_bar()
```
## Bringing all the symptoms togther
::::: columns
::: {.column width="50%"}
```{r symptoms_all2, fig.width=7, fig.height=4, fig.align='center'}
#| echo: false
#| output-location: fragment
ggplot(data = symptoms,
aes(y = symptom, fill = status))+
geom_bar()
```
:::
::: {.column width="50%"}
- This doesn't necessarily help us to decide what is making the students sick because they are not separated as to whether they were [sick]{.purple} or not
- We really want to separate those that have a [YES]{.purple} in `Sickness`
:::
:::::
## We can filter this list to just those that are sick !
This needs the `filter()` command
```{r filter1}
#| echo: true
#| output-location: fragment
symptoms_sick <- symptoms %>%
filter(sickness=="yes")
```
## Now, what symptoms do the sick students have ?
```{r bar_sick, fig.width=6, fig.height=4}
#| echo: true
#| output-location: fragment
ggplot(data = symptoms_sick,
aes(y = symptom, fill = status))+
geom_bar()+
labs(title = "What symptoms do the sick students have ?")
```
## Interpreting our data
```{r cause_sickness}
#| include: true
#| echo: false
ggplot(data = symptoms_sick,
aes(y = symptom, fill = status))+
geom_bar()+
labs(title = "What symptoms do the sick students have ?")
```
What does this graph tell us?
- What are the symptoms of those that are sick?
- What might be some causes of illness that give these symptoms?
## Likely cause...
# Salmonella {background-color="#935d94"}
## What is [salmonella](https://www.cdc.gov/salmonella/general/index.html)?
- A bacterial infection
- Commonly from contaminated food
- Examples...undercooked chicken, raw egg, insufficient cleaning
- You can start to feel sick within 6 to 36 hours after eating
## But how did the students get sick ? {data-menu-title="Where did the students get sick" background-color="#935d94" style="font-size:70px;padding: 5px"}
## Challenge: Where did the students get sick?
🎨 At the gallery?
. . .
🚌 On the bus?
. . .
🍲 At lunch?
## WAIT ! We have some more information
🍲 We have just been sent some information about where the student's ate lunch !
. . .
They ate at three different restaurants !
```{r map_data}
source(here::here("setup/map.R"))
```
```{r}
#| echo: false
#| include: false
# Load the coordinates data of the students
# map_data = read.delim("https://raw.githubusercontent.com/shaziaruybal/2022-05-04-It-takes-a-spark/master/data/Coordinates_student_data.txt")
# map_data <- map_data %>%
# mutate(long = case_when(
# Longitude==650 ~ 144.9658,
# Longitude==1100 ~ 144.9679,map
# Longitude==620 ~ 144.9657
# )) %>%
# mutate(lat = case_when(
# Latitude==950 ~ -37.8189,
# Latitude==800~ -37.8197,
# Latitude==650 ~ -37.8204,
# )) %>% write_csv(here::here("map_data.csv"))
#the above was to fix the coordinates so that they plotted on out plot
```
## Plot where the students ate their lunch...
```{r plot_melb_map}
#| echo: true
#| output-location: fragment
#|
ggmap(melb_map)+
geom_point(data=map_data, aes(x =long, y = lat, colour = sickness), size = 12, shape = 1,)
```
## This was based on a real life outbreak in Melbourne !
![](presentation/abc_news.png)
[ABC New 2015](https://www.abc.net.au/news/2015-08-25/raw-egg-mayonnaise-blamed-for-langham-hotel-salmonella-outbreak/6722062)
## Today we have learnt...
. . .
🦠 what are pathogens and what are outbreaks
. . .
🌎 Who are epidemiologists
. . .
🔢 What is R
. . .
📊 How to make plots with ggplot
. . .
📈 How to organise and arrange complex data