-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.xml
executable file
·2205 lines (1703 loc) · 150 KB
/
index.xml
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
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>BES QUANTITATIVE ECOLOGY GROUP on BES QUANTITATIVE ECOLOGY GROUP</title>
<link>https://BES-QSIG.github.io/</link>
<description>Recent content in BES QUANTITATIVE ECOLOGY GROUP on BES QUANTITATIVE ECOLOGY GROUP</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language>
<copyright>&copy; 2021</copyright>
<lastBuildDate>Mon, 01 Nov 2021 00:00:00 +0000</lastBuildDate>
<atom:link href="/" rel="self" type="application/rss+xml" />
<item>
<title>We're hiring!</title>
<link>https://BES-QSIG.github.io/post/sig-secretary/</link>
<pubDate>Mon, 01 Nov 2021 00:00:00 +0000</pubDate>
<guid>https://BES-QSIG.github.io/post/sig-secretary/</guid>
<description><p>The Quantitative Ecology Special Interest Group is looking for our new
Secretary. Do you work in quantitative ecology and want to help shape
the future of the SIG? If so, this role is for you! You will be
responsible for planning future events which meet the aims of the SIG:</p>
<ul>
<li>Support quantitative skills development for all ecologists</li>
<li>Improve dissemination of new quantitative methods to their users</li>
<li>Provide a forum to advance quantitative ecology in its own right</li>
</ul>
<p>If you are interested in applying, please send a brief covering letter
and CV to
<a href="mailto:[email protected]" target="_blank">[email protected]</a>
by Friday 19th November 2021. Your covering letter should address the
following points:</p>
<ol>
<li><p>Experience of organising events.</p></li>
<li><p>Experience in managing budgets.</p></li>
<li><p>The kinds of ideas you have for future SIG events.</p></li>
<li><p>Ability to travel to SIG meetings and events.</p></li>
<li><p>Evidence of ability to promote the SIG within and outside of BES.</p></li>
</ol>
</description>
</item>
<item>
<title>Quantitative Ecology SIG Annual (Virtual) Meeting 2021</title>
<link>https://BES-QSIG.github.io/events/annualmeet_2021/</link>
<pubDate>Tue, 27 Jul 2021 00:00:00 +0100</pubDate>
<guid>https://BES-QSIG.github.io/events/annualmeet_2021/</guid>
<description><h2 class="subtitle">Programme</h2>
<p>This year’s meeting will take place across three days, with themes of:</p>
<ul>
<li>Integrating models and data in ecology</li>
<li>Bringing together mathematicians and quantitative ecologists</li>
<li>Interdisciplinary quantitative ecology</li>
</ul>
<p>To accommodate time zone differences, the conference will take place at different times each day as follows:</p>
<ul>
<li>Tuesday 31st August: 8am – 11am BST (GMT +1)</li>
<li>Wednesday 1st September: 5pm – 8pm BST
*Thursday 2nd September: 11am – 2pm BST</li>
</ul>
<p>In addition, we will have two keynote speakers on each day, at least one of whom is an ECR, there will be short talks, networking and a virtual poster session.</p>
<h2 class="subtitle">Keynote speakers</h2>
<p>Confirmed keynote speakers:</p>
<ul>
<li><strong><a href="https://www.ufz.de/index.php?en=45284" target="_blank">Diana Bowler</a></strong>, German Centre for Integrative Biodiversity Research (iDiv)</li>
<li><strong><a href="https://www.gla.ac.uk/researchinstitutes/bahcm/staff/richardreeve/#biography" target="_blank">Richard Reeve</a></strong>, University of Glasgow</li>
<li><strong><a href="http://natashaellison.co.uk/" target="_blank">Natasha Ellison</a></strong>, University of Sheffield</li>
</ul>
<h2 class="subtitle">Talks and posters</h2>
<p>We invite contributed talks which will be 5 minutes in length. These can either be presented live or pre-recorded. Please submit your title when registering for the meeting, and choose which day/time slot you would prefer. If you would like to present a poster, please submit your title when registering for the meeting, and choose which day/time slot you would prefer.</p>
<p>Talk and poster title deadline is <strong>23:59 BST (GMT+1) 13 August 2021</strong>. We will contact attendees after this to confirm talk slots.</p>
<h2 class="subtitle">Registration</h2>
<p>Registration deadline is <strong>23:59 BST, 16 August 2021</strong>.</p>
<p>Register <a href="https://www.eventbrite.co.uk/e/quantitative-sig-annual-meeting-2021-tickets-163389130287" target="_blank"><strong>here</strong></a></p>
</description>
</item>
<item>
<title>Quantitative Ecology Virtual Meeting 2020</title>
<link>https://BES-QSIG.github.io/events/annualmeet_2020/</link>
<pubDate>Wed, 01 Jul 2020 00:00:00 +0100</pubDate>
<guid>https://BES-QSIG.github.io/events/annualmeet_2020/</guid>
<description><p>Join the BES Quantitative Ecology SIG for their 3rd Annual Meeting, and first virtual meeting. There will be 4 sessions across the week, and each will have a keynote, 5-minute lightning talks, and a discussion around the session’s theme. There will also be a “coffee” break in each session to give you the chance to talk to other delegates, and there will be some networking activities, including a quiz on the Wednesday evening (BST).</p>
<p>The aim of the Quantitative Ecology SIG is threefold:</p>
<ul>
<li>Support quantitative skills development for all ecologists</li>
<li>Improve dissemination of new quantitative methods to their users</li>
<li>Provide a forum to advance quantitative ecology in its own right</li>
</ul>
<p>This event is for any ecologist who wants to share new quantitative methods, or original research using quantitative methods; who wants to broaden their understanding of quantitative ecology; or who wants to join the discussion around how we can move quantitative ecology forward.</p>
<h2 class="subtitle">Programme</h2>
<p><strong>Monday 27th July (4PM – 7PM, BST, click link for time zone conversion)</strong></p>
<p>Session theme: Network Ecology<br />
Keynote speaker: Laura Dee, University of Colorado, Boulder</p>
<p><strong>Tuesday 28th July (10AM – 1PM)</strong></p>
<p>Session theme: Systems Ecology<br />
Keynote speaker: Jean-Francois Arnoldi, Trinity College Dublin</p>
<p><strong>Wednesday 29th July (4PM – 7PM)</strong></p>
<p>Session theme: Disease Ecology<br />
Keynote speaker: Lewis Bartlett, University of Georgia</p>
<p><strong>Thursday 30th July (10AM – 1PM)</strong></p>
<p>Session theme: Teaching and Learning Quantitative Ecology<br />
Keynote speaker: Gergana Daskalova, University of Edinburgh</p>
<h2 class="subtitle">Lightning talks</h2>
<p>If you would like to be considered to give a 5-minute lightning talk, please submit a title and select the appropriate session when prompted in the registration form.</p>
<h2 class="subtitle">Registration</h2>
<p>This event will take place on Zoom, and a link will be sent out to all attendees prior to the event.</p>
<p>The registration and abstract submission deadline is <strong>Friday 17 July.</strong></p>
<p>Register <a href="https://www.eventbrite.co.uk/e/bes-quantitative-ecology-virtual-meeting-2020-tickets-109796596576" target="_blank">here</a></p>
</description>
</item>
<item>
<title>Quantitative Ecology Speed-Share-Your-Research</title>
<link>https://BES-QSIG.github.io/events/bes2019_social/</link>
<pubDate>Fri, 06 Dec 2019 00:00:00 +0000</pubDate>
<guid>https://BES-QSIG.github.io/events/bes2019_social/</guid>
<description><p>Get to meet more quantitative ecologists and learn about the wide range of work done by members of our SIG. Then relax and enjoy food, drinks and live music for the rest of the evening in a local Belfast venue.</p>
</description>
</item>
<item>
<title>Open committee positions</title>
<link>https://BES-QSIG.github.io/post/open-committee-positions/</link>
<pubDate>Mon, 02 Dec 2019 00:00:00 +0000</pubDate>
<guid>https://BES-QSIG.github.io/post/open-committee-positions/</guid>
<description><p><strong>Deputy Secretary</strong></p>
<p>We are looking for a Quantitative Ecologist to step into the deputy secretary role and provide some continuity to the SIG leadership. The deputy secretary role involves:</p>
<ul>
<li>Supporting the secretary in the running of the SIG - helping with budgets, suggesting events etc.</li>
<li>Attending meetings at BES HQ twice a year (travel &amp; accommodation covered)</li>
<li>Seek to expand the SIG and promote quantitative ecology within the BES</li>
</ul>
<p><strong>Policy Rep</strong></p>
<p>Do you work in policy, or do policy-focused research and consider yourself a quantitative ecologist? We are looking to take on someone to be our policy rep. The policy rep will aim to develop events (with the support of the rest of the committee) that bring together policy makers and quantitative ecologists, or that are focused around policy issues.</p>
<p><strong>To apply</strong></p>
<p>Please send a copy of your CV, and a few sentences about what you would do in the role to <a href="mailto:[email protected]" target="_blank">[email protected]</a>. If you have any questions at all, do not hesitate to get in touch.</p>
</description>
</item>
<item>
<title>Interdisciplinary model integration thematic session at BES2019</title>
<link>https://BES-QSIG.github.io/events/imi-bes2019/</link>
<pubDate>Fri, 26 Jul 2019 00:00:00 +0100</pubDate>
<guid>https://BES-QSIG.github.io/events/imi-bes2019/</guid>
<description><p>We are lucky to be joining a fantastic session line-up with our thematic session on <strong>Interdisciplinary model integration to better understand biodiversity change</strong> at this year’s BES annual meeting in Belfast.</p>
<p>The main drivers of global biodiversity change are climate change, land-use change, pollution and overfishing, which result directly from human-mediated activities, transgress ecosystems and political borders, and act globally. For a more complete understanding of biodiversity changes, integrating models from different disciplines at large spatial and temporal scales is crucial. Interdisciplinary approaches to biodiversity assessment have received increasing attention in recent years, particularly with the launch of the new BES People and Nature journal. The surge in efforts to provide a more complete picture of the socioeconomic and biophysical drivers of biodiversity change highlights new computational possibilities, unprecedented data availability, and a fast-growing acknowledgement of the importance of driver interactions across disciplines and spatial scales.</p>
<p>Our thematic session will put the spotlight on this emerging area of research and help identify the potential for future directions and rapid developments in the field. Specifically, we will:</p>
<ol>
<li>provide a unique showcase of conceptual approaches and methodological tools currently used in integrated biodiversity assessment,</li>
<li>contribute to a better understanding of interdisciplinary system complexity in such assessments,</li>
<li>highlight strategies to reduce model and prediction uncertainty, and</li>
<li>enhance the set of robust tools available to inform policy.</li>
</ol>
<p>Further details and the session schedule will be published through the official BES2019 programme release. A full list of thematic sessions is available <a href="https://www.britishecologicalsociety.org/events/annual-meeting-2019/call-thematic-sessions/" target="_blank">here</a>.</p>
</description>
</item>
<item>
<title>2019 BES Quantitative & Movement Ecology SIG Annual Meeting</title>
<link>https://BES-QSIG.github.io/events/quantmove2019/</link>
<pubDate>Wed, 22 May 2019 00:00:00 +0100</pubDate>
<guid>https://BES-QSIG.github.io/events/quantmove2019/</guid>
<description>
<p><img src="QuantMove2019.png" alt="Caption" /></p>
<p>The BES Quantitative and Movement Ecology special interest groups will be holding their annual meetings back to back <strong>on 9th &amp; 10th July 2019 in Sheffield</strong>. This joint meeting will take advantage of shared strengths as well as shared challenges between the two groups, and foster links between them.</p>
<p>The meeting will be along the common theme of Analysing big datasets while answering big ecological questions and the challenges associated with it. We welcome talks, posters and will have discussions on general issues with computation; integrating different datasets; and propagating uncertainty in ecological analyses.</p>
<p>Attendees will have the opportunity to attend one, or both annual meetings. Note that it is cheaper to join the BES as a member and register for a BES member ticket, than to register for the non-BES member ticket.</p>
<h2 id="quantitative-ecology-keynotes">Quantitative Ecology keynotes</h2>
<p><br></p>
<table>
<tr>
<td class="leftcol"><img src="JamesGrecian.png"/></td>
<td class="rightcol">
<table><b><a href = "http://www.jamesgrecian.com/">James Grecian</a></b><br>
<span class="member_affiliation">University of St Andrews</span></table>
<p> James' research focuses on understanding how marine predators interact with their environment, particularly the effect that human impacts such as offshore energy extraction, fisheries and climate change have on foraging behaviour and migration.</p>
</td>
</tr>
</table>
<table>
<tr>
<td class="leftcol"><img src="RachelMcCrea.png"/></td>
<td class="rightcol">
<table><b><a href = "https://www.kent.ac.uk/mathematics-statistics-actuarial-science/people/1060/mccrea-rachel">Rachel McCrea</a></b><br>
<span class="member_affiliation">University of Kent</span></table>
<p> Rachel is an applied statistician working closely with ecologists as well as statisticians, developing new statistical methodology for the modelling of ecological data. She has worked extensively with capture-recapture data and is particularly interested in the potential of multi-state models. Her research has included the development of goodness-of-fit assessment and model selection strategies for complex data sets. Modelling population dynamics, integrated population modelling and survey design are also current areas of interest.</p>
</td>
</tr>
</table>
<h2 id="movement-ecology-keynotes">Movement Ecology Keynotes</h2>
<p><br></p>
<table>
<tr>
<td class="leftcol"><img src="SamanthaPatrick.png"/></td>
<td class="rightcol">
<table><b><a href = "https://samanthacpatrick.wixsite.com/home">Samantha Patrick</a></b><br>
<span class="member_affiliation">University of Liverpool</span></table>
<p> Samantha is a behavioural ecologist interested in individual differences in mating strategies. She focuses on reproductive tactics and foraging behaviour and considers how and why alternative strategies are maintained in the population. She has worked mainly on avian systems, from great tits to albatrosses, and examined the causes and consequence of individual variation.</p>
</td>
</tr>
</table>
<table>
<tr>
<td class="leftcol"><img src="KarineHeerah.png"/></td>
<td class="rightcol">
<table><b><a href = "https://www.researchgate.net/profile/Karine_Heerah">Karine Heerah</a></b><br>
<span class="member_affiliation">Aarhus University</span></table>
<p> Karine is a Marie Sklodowska Curie Fellow working in the lab of Prof. Peter Madsen at Aarhus University.</p>
</td>
</tr>
</table>
<table>
<tr>
<td class="leftcol"><img src="TheoMichelot.png"/></td>
<td class="rightcol">
<table><b><a href = "http://theo-michelot.postgrad.shef.ac.uk/">Théo Michelot</a></b><br>
<span class="member_affiliation">University of St Andrews</span></table>
<p> Théo is a newly appointed Research Fellow in the School of Mathematics and Statistics at the University of St Andrews. He specialises in analyses of animal movement.</p>
</td>
</tr>
</table>
<table>
<tr>
<td class="leftcol"><img src="GrantHopcraft.png"/></td>
<td class="rightcol">
<table><b><a href = "https://www.gla.ac.uk/researchinstitutes/bahcm/staff/granthopcraft/">Grant Hopcraft</a></b><br>
<span class="member_affiliation">University of Glasgow</span></table>
<p> Grant's research broadly investigates landscape-scale ecological processes that determine the distribution and abundance of animals. He focuses on African savannahs as model ecosystems to investigate how underlying biogeographical gradients, such as rainfall and soil fertility, influence animal nutrition and predation rates, and how these gradients structure community assemblages.</p>
</td>
</tr>
</table>
<h2 id="talks-and-posters">TALKS AND POSTERS</h2>
<p>We will have slots for talks and space for posters at the meeting!</p>
<p>Talks will be <strong>5 minutes</strong> long. There may not be enough talk slots for everyone, so priority will be given to early career researchers. Please include a rough title when you register so we have an idea of the balance of topics (you can change it later). Students will also be given the option to put themselves forward for the student plenary talk (20 minutes). We highly recommend applying; it&rsquo;s fun and a great thing to put on your CV.</p>
<h2 id="accessibility">ACCESSIBILITY</h2>
<p>All facilities, rooms and spaces in the conference venue are wheelchair-accessible and there are disabled parking spaces nearby. See <a href="https://www.accessable.co.uk/venues/alfred-denny-building" target="_blank">https://www.accessable.co.uk/venues/alfred-denny-building</a> for more information and please contact us if you have any questions.</p>
<h2 id="families-and-childcare">FAMILIES AND CHILDCARE</h2>
<p>If you plan to bring your baby or young child to the meeting, please get in touch with us to let us know what facilities you would require, for example, a room for nursing or créche facilities. We have not made any specific arrangements for families but we will be happy to help as much as we can.</p>
<h2 id="accommodation">ACCOMMODATION</h2>
<p><a href="https://www.sheffield.ac.uk/accommodation/visitors" target="_blank">https://www.sheffield.ac.uk/accommodation/visitors</a></p>
<h2 id="twitter">TWITTER</h2>
<p>#BESQuantMove2019</p>
<h2 id="deadline">DEADLINE</h2>
<p>The deadline for registration is <strong>Friday, 7th June 2019</strong> (11:59 PM UK time). We will contact attendees after this to confirm talk slots.</p>
<h2 id="register">REGISTER</h2>
<p>You can register on our <a href="https://www.eventbrite.co.uk/e/bes-quantitative-movement-ecology-2019-tickets-59447350626" target="_blank">EventBrite</a> page.</p>
<h2 id="contact">CONTACT</h2>
<p>Feel free to contact us on twitter <a href="https://twitter.com/BES_QE_SIG" target="_blank">@bes_qe_sig</a> and <a href="https://twitter.com/BES_Move_SIG" target="_blank">@bes_move_sig</a> or by emailing <a href="mailto:[email protected]" target="_blank">[email protected]</a> or <a href="mailto:[email protected]" target="_blank">[email protected]</a></p>
</description>
</item>
<item>
<title>Quantitative Ecology Special Interest Group QE-SIG</title>
<link>https://BES-QSIG.github.io/about/qesig/</link>
<pubDate>Sun, 24 Feb 2019 00:00:00 +0000</pubDate>
<guid>https://BES-QSIG.github.io/about/qesig/</guid>
<description><p>We have migrated from our old <a href="https://besquantitativeecology.wordpress.com/" target="_blank">Wordpress site</a> in order to keep everything in one place. Our Wordpress site will function as an archive, but new material will be updated here.</p>
<p>Our aim as a group is to:</p>
<ul>
<li>Support quantitative skills development for all ecologists</li>
<li>Improve dissemination of new quantitative methods to their users</li>
<li>Provide a forum to advance quantitative ecology in its own right</li>
</ul>
<p>If you have ideas for events, workshops or courses that you would like to see us organise (or would like to organise yourself with our support), please <a href="https://BES-QSIG.github.io/#contact">contact us</a>.</p>
</description>
</item>
<item>
<title>Welcome to the new Quantitative Ecology Site</title>
<link>https://BES-QSIG.github.io/post/welcome-to-new-site/</link>
<pubDate>Tue, 27 Nov 2018 00:00:00 +0000</pubDate>
<guid>https://BES-QSIG.github.io/post/welcome-to-new-site/</guid>
<description><p>We have migrated from our old <a href="https://besquantitativeecology.wordpress.com/" target="_blank">Wordpress site</a> in order to keep everything in one place. Our Wordpress site will function as an archive, but new material will be updated here.</p>
<p>Our aim as a group is to:</p>
<ul>
<li>Support quantitative skills development for all ecologists</li>
<li>Improve dissemination of new quantitative methods to their users</li>
<li>Provide a forum to advance quantitative ecology in its own right</li>
</ul>
<p>If you have ideas for events, workshops or courses that you would like to see us organise (or would like to organise yourself with our support), please <a href="https://BES-QSIG.github.io/#contact">contact us</a>.</p>
</description>
</item>
<item>
<title>Advancing Your R</title>
<link>https://BES-QSIG.github.io/courses/advancingr/</link>
<pubDate>Tue, 20 Nov 2018 00:00:00 +0000</pubDate>
<guid>https://BES-QSIG.github.io/courses/advancingr/</guid>
<description>
<h2 id="pre-course-instructions">Pre-course Instructions</h2>
<p>Below see instructions on the software and R packages to install <strong>before</strong> you arrive. Note that you will receive the greatest benefit of the course if you have already installed the software and packages.</p>
<p>You will need to have an up-to-date installation of <a href="https://cran.r-project.org/mirrors.html" target="_blank">R</a> and <a href="https://www.rstudio.com/products/rstudio/download/#download" target="_blank">RStudio</a>.</p>
<p>You will need to install <a href="https://www.postgresql.org/download/" target="_blank">PostgreSQL</a>.</p>
<p>You will also need to install some R packages using the below code:</p>
<pre><code>install.packages(&quot;rmarkdown&quot;)
install.packages(&quot;tidyverse&quot;)
install.packages(&quot;broom&quot;)
install.packages(&quot;ggExtra&quot;)
install.packages(&quot;maps&quot;)
install.packages(&quot;RColorBrewer&quot;)
install.packages(&quot;gridExtra&quot;)
install.packages(&quot;rgbif&quot;)
install.packages(&quot;CoordinateCleaner&quot;)
install.packages(&quot;ggrepel&quot;)
install.packages(&quot;png&quot;)
install.packages(&quot;mapdata&quot;)
install.packages(&quot;ggthemes&quot;)
install.packages(&quot;sf&quot;)
install.packages(&quot;RPostgreSQL&quot;)
</code></pre>
<h2 id="getting-here">Getting here</h2>
<p>The course is taking place in the Waterhouse Room at the <a href="https://www.liverpool.ac.uk/conferences-and-events/venue-finder/foresight-centre/" target="_blank">Foresight Centre</a>, University of Liverpool.</p>
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d1681.7435965583238!2d-2.9694946677972656!3d53.40866296464316!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x487b211782d9e8e3%3A0x8524f47e6bc7433d!2sForesight+Centre+(Block+J)%2C+Liverpool+L3+5QA!5e0!3m2!1sen!2suk!4v1543347942213" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>
<h3 id="road">Road</h3>
<p>From the M62 (end of motorway 3 miles)</p>
<p>From the M53( Wirral/Mersey Tunnels <sup>3</sup>&frasl;<sub>4</sub> mile)</p>
<p>Please use L3 5DA for sat nav</p>
<h3 id="rail">Rail</h3>
<p>Liverpool Lime St Station is a 10 minute walk.</p>
<p>For local public transport please contact Merseytravel</p>
<h3 id="air">Air</h3>
<p>Liverpool John Lennon Airport is 7 Miles away from the Foresight Centre.</p>
<p>The Airlink 500 loops to the city centre every 30 minutes.</p>
</description>
</item>
<item>
<title>Day One: Data manipulation and Visualisation using the tidyverse</title>
<link>https://BES-QSIG.github.io/courses/advancingr-tidyverse/</link>
<pubDate>Tue, 20 Nov 2018 00:00:00 +0000</pubDate>
<guid>https://BES-QSIG.github.io/courses/advancingr-tidyverse/</guid>
<description>
<h1 id="part-i-create-a-reproducible-report-using-markdown">PART I: Create a reproducible report using Markdown</h1>
<h2 id="1-what-is-r-markdown">1. What is R Markdown?</h2>
<p>R Markdown allows you to create documents that serve as a neat record of your analysis. In the world of reproducible research, we want other researchers to easily understand what we did in our analysis. You might choose to create an R markdown document as an appendix to a paper or project assignment that you are doing, upload it to an online repository such as Github, or simply to keep as a personal record so you can quickly look back at your code and see what you did. R Markdown presents your code alongside its output (graphs, tables, etc.) with conventional text to explain it, a bit like a notebook. Your report can also be what you base your future methods and results sections in your manuscripts, thesis chapters, etc.</p>
<p>R Markdown uses <a href="http://www.markdowntutorial.com" target="_blank">markdown syntax</a>. Markdown is a very simple &lsquo;markup&rsquo; language which provides methods for creating documents with headers, images, links etc. from plain text files, while keeping the original plain text file easy to read. You can convert Markdown documents to other file types like <code>.html</code> or <code>.pdf</code>.</p>
<p><center> <img src="https://BES-QSIG.github.io/courses/advancingr/md_script.png" alt="Img" style="width: 900px;"/> </center></p>
<h2 id="2-download-r-markdown">2. Download R Markdown</h2>
<p>To get R Markdown working in RStudio, the first thing you need is the <code>rmarkdown</code> package, which you can get from <a href="https://cran.r-project.org/web/packages/rmarkdown/index.html" target="_blank">CRAN</a> by running the following commands in R or RStudio:</p>
<pre><code class="language-r">install.packages(&quot;rmarkdown&quot;)
library(rmarkdown)
</code></pre>
<h2 id="3-the-different-parts-of-an-r-markdown-file">3. The different parts of an R Markdown file</h2>
<h3 id="the-yaml-header">The YAML Header</h3>
<p>At the top of any R Markdown script is a <code>YAML</code> header section enclosed by <code>---</code>. By default this includes a title, author, date and the file type you want to output to. Many other options are available for different functions and formatting, see <a href="http://rmarkdown.rstudio.com/html_document_format.html" target="_blank">here for <code>.html</code> options</a> and <a href="http://rmarkdown.rstudio.com/pdf_document_format.html" target="_blank">here for <code>.pdf</code> options</a>. Rules in the header section will alter the whole document.</p>
<p>Add your own details at the top of your<code>.Rmd</code> script, e.g.:</p>
<pre><code>---
title: &quot;The tidyverse in action - population change in forests&quot;
author: Gergana Daskalova
date: 22/Oct/2016
output: html_document
---
</code></pre>
<p>By default, the <code>title</code>, <code>author</code>, <code>date</code> and <code>output</code> format are printed at the top of your <code>.html</code> document.</p>
<p>Now that we have our first piece of content, we can test the <code>.Rmd</code> file by compiling it to <code>.html</code>. To compile your <code>.Rmd</code> file into a <code>.html</code> document, you should press the <code>Knit</code> button in the taskbar:</p>
<p><img src="https://BES-QSIG.github.io/courses/advancingr/Knit_HTML_Screenshot.jpg" alt="Img"></p>
<p>Not only does a preview appear in the <code>Viewer</code> window in RStudio, but it also saves a <code>.html</code> file to the same folder where you saved your <code>.Rmd</code> file.</p>
<p><a name="insert"></a></p>
<h3 id="code-chunks">Code Chunks</h3>
<p><strong>Have a read through the text below to learn a bit more about how Markdown works and then you can start compiling the rest of your <code>.Md</code> file.</strong></p>
<h4 id="the-setup-chunk">The setup chunk</h4>
<p><strong>This code chunk appears in <code>.Md</code> files in R by default, it won&rsquo;t appear in your html or pdf document, it just sets up the document.</strong></p>
<pre><code>```{r setup, include = FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
</code></pre>
<h4 id="the-rest-of-the-code-chunks">The rest of the code chunks</h4>
<p>This is where you can add your own code, accompanying explanation and any outputs. Code that is included in your <code>.Rmd</code> document should be enclosed by three backwards apostrophes <code>```</code> (grave accents!). These are known as code chunks and look like this (no need to copy this, just an example):</p>
<pre><code>```{r}
norm &lt;- rnorm(100, mean = 0, sd = 1)
```
</code></pre>
<p>Inside the curly brackets is a space where you can assign rules for that code chunk. The code chunk above says that the code is R code.</p>
<p>It&rsquo;s important to remember when you are creating an R Markdown file that if you want to run code that refers to an object, for example:</p>
<pre><code>```{r}
plot(dataframe)
```
</code></pre>
<p>You have to include the code that defines what <code>dataframe</code> is, just like in a normal R script. For example:</p>
<pre><code>```{r}
A &lt;- c(&quot;a&quot;, &quot;a&quot;, &quot;b&quot;, &quot;b&quot;)
B &lt;- c(5, 10, 15, 20)
dataframe &lt;- data.frame(A, B)
plot(dataframe)
```
</code></pre>
<p>Or if you are loading a dataframe from a <code>.csv</code> file, you must include the code in the <code>.Rmd</code>:</p>
<pre><code>```{r}
dataframe &lt;- read.csv(&quot;~/Desktop/Code/dataframe.csv&quot;)
```
</code></pre>
<p>Similarly, if you are using any packages in your analysis, you have to load them in the <code>.Rmd</code> file using <code>library()</code> like in a normal R script.</p>
<pre><code>```{r}
library(dplyr)
```
</code></pre>
<h4 id="hiding-code-chunks">Hiding code chunks</h4>
<p>If you don&rsquo;t want the code of a particular code chunk to appear in the final document, but still want to show the output (e.g. a plot), then you can include <code>echo = FALSE</code> in the code chunk instructions.</p>
<pre><code>```{r, echo = FALSE}
A &lt;- c(&quot;a&quot;, &quot;a&quot;, &quot;b&quot;, &quot;b&quot;)
B &lt;- c(5, 10, 15, 20)
dataframe &lt;- data.frame(A, B)
plot(dataframe)
```
</code></pre>
<p>Sometimes, you might want to create an object, but not include both the code and its output in the final <code>.html</code> file. To do this you can use, <code>include = FALSE</code>. Be aware though, when making reproducible research it&rsquo;s often not a good idea to completely hide some part of your analysis:</p>
<p><strong>REMEMBER: R Markdown doesn&rsquo;t pay attention to anything you have loaded in other R scripts, you have to load all objects and packages in the R Markdown script.</strong></p>
<p><strong>Now you can start copying across the code from your tidyverse script and insert it into a code chunk in your <code>.Rmd</code> document. Better not to do it all at once, you can start with the first parts of the tidyverse script and gradually add on more after you&rsquo;ve seen what the <code>.Rmd</code> output looks like.</strong></p>
<p>You can run an individual chunk of code at any time by placing your cursor inside the code chunk and selecting <code>Run -&gt; Run Current Chunk</code>:</p>
<p><img src="https://BES-QSIG.github.io/courses/advancingr/run_sel.png" alt="Img" style="width: 900px;"/></p>
<h3 id="summary-of-code-chunk-instructions">Summary of code chunk instructions</h3>
<p><style type="text/css">
.tg {border-collapse:collapse;border-spacing:0;}
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg .tg-yw4l{vertical-align:top}
</style>
<table class="tg">
<tr>
<th class="tg-yw4l"><b>Rule</b></th>
<th class="tg-yw4l"><b>Example</b><br>(default)</th>
<th class="tg-yw4l"><b>Function</b></th>
</tr>
<tr>
<td class="tg-yw4l">eval</td>
<td class="tg-yw4l">eval=TRUE</td>
<td class="tg-yw4l">Is the code run and the results included in the output?</td>
</tr>
<tr>
<td class="tg-yw4l">include</td>
<td class="tg-yw4l">include=TRUE</td>
<td class="tg-yw4l">Are the code and the results included in the output?</td>
</tr>
<tr>
<td class="tg-yw4l">echo</td>
<td class="tg-yw4l">echo=TRUE</td>
<td class="tg-yw4l">Is the code displayed alongside the results?</td>
</tr>
<tr>
<td class="tg-yw4l">warning</td>
<td class="tg-yw4l">warning=TRUE</td>
<td class="tg-yw4l">Are warning messages displayed?</td>
</tr>
<tr>
<td class="tg-yw4l">error</td>
<td class="tg-yw4l">error=FALSE</td>
<td class="tg-yw4l">Are error messages displayed?</td>
</tr>
<tr>
<td class="tg-yw4l">message</td>
<td class="tg-yw4l">message=TRUE</td>
<td class="tg-yw4l">Are messages displayed?</td>
</tr>
<tr>
<td class="tg-yw4l">tidy</td>
<td class="tg-yw4l">tidy=FALSE</td>
<td class="tg-yw4l">Is the code reformatted to make it look “tidy”?</td>
</tr>
<tr>
<td class="tg-yw4l">results</td>
<td class="tg-yw4l">results=&ldquo;markup&rdquo;</td>
<td class="tg-yw4l"><b> How are results treated? </b> <br> &ldquo;hide&rdquo; = no results <br>&ldquo;asis&rdquo; = results without formatting <br>&ldquo;hold&rdquo; = results only compiled at end of chunk (use if many commands act on one object)</td>
</tr>
<tr>
<td class="tg-yw4l">cache</td>
<td class="tg-yw4l">cache=FALSE</td>
<td class="tg-yw4l">Are the results cached for future renders?</td>
</tr>
<tr>
<td class="tg-yw4l">comment</td>
<td class="tg-yw4l">comment=&ldquo;##&rdquo;</td>
<td class="tg-yw4l">What character are comments prefaced with?</td>
</tr>
<tr>
<td class="tg-yw4l">fig.width, fig.height</td>
<td class="tg-yw4l">fig.width=7</td>
<td class="tg-yw4l">What width/height (in inches) are the plots?</td>
</tr>
<tr>
<td class="tg-yw4l">fig.align</td>
<td class="tg-yw4l">fig.align=&ldquo;left&rdquo;</td>
<td class="tg-yw4l">&ldquo;left&rdquo; &ldquo;right&rdquo; &ldquo;center&rdquo;</td>
</tr>
</table></p>
<h2 id="4-inserting-figures">4. Inserting Figures</h2>
<p>By default, RMarkdown will place graphs by maximising their height, while keeping them within the margins of the page and maintaining aspect ratio. If you have a particularly tall figure, this can mean a really huge graph. To manually set the figure dimensions, you can insert an instruction into the curly braces:</p>
<pre><code>```{r, fig.width = 2.5, fig.height = 7.5}
ggplot(df, aes(x = x, y = y) + geom_point()
```
</code></pre>
<h2 id="5-inserting-tables">5. Inserting Tables</h2>
<p>R Markdown can print the contents of a data frame easily by enclosing the name of the data frame in a code chunk:</p>
<pre><code>```{r}
dataframe
```
</code></pre>
<p>This can look a bit messy, especially with data frames with a lot of columns. You can also use a table formatting function, e.g. <code>kable()</code> from the <code>knitr</code> package. The first argument tells kable to make a table out of the object <code>dataframe</code> and that numbers should have two significant figures. Remember to load the <code>knitr</code> package in your <code>.Rmd</code> file, if you are using the <code>kable()</code> function.</p>
<pre><code>```{r}
kable(dataframe, digits = 2)
```
</code></pre>
<p>If you want a bit more control over the content of your table you can use <code>pander()</code> from the <code>pander</code> package. Imagine I want the 3rd column to appear in italics:</p>
<pre><code>```{r}
emphasize.italics.cols(3) # Make the 3rd column italics
pander(richness_abund) # Create the table
```
</code></pre>
<p><strong>Now that you have started your <code>Markdown</code> document, you can use that when completing the next part of the tutorial, i.e., inserting the code that follows into code chunks and then generating a report at the end of this tutorial.</strong></p>
<h1 id="part-ii-analyse-and-visualise-data-using-the-tidyverse">PART II: Analyse and visualise data using the <code>tidyverse</code></h1>
<h2 id="learning-objectives">Learning Objectives</h2>
<h2 id="1-intro-to-the-tidyverse">1. Intro to the <code>tidyverse</code></h2>
<h3 id="how-to-analyse-population-change-of-forest-vertebrates">How to analyse population change of forest vertebrates</h3>
<ol>
<li>How to write a custom <code>ggplot2</code> function</li>
<li>How to use <code>gather()</code> and <code>spread()</code> from the <code>tidyr</code> package</li>
<li>How to parse numbers using <code>parse_number()</code> from the <code>readr</code> package</li>
<li>How to use the <code>distinct()</code> function from <code>dplyr</code></li>
<li>How to use the <code>filter()</code> function from <code>dplyr</code></li>
<li>How to use the <code>mutate()</code> function from <code>dplyr</code></li>
<li>How to use the <code>summarise()</code>/<code>summarize()</code> function from <code>dplyr</code></li>
<li>How to use the <code>tidy()</code> function from the <code>broom</code> package to summarise model results</li>
<li>How to use the <code>select()</code> function from <code>dplyr</code></li>
</ol>
<p><b>In this tutorial, we will focus on how to efficiently format, manipulate and visualise large datasets. We will use the <code>tidyr</code> and <code>dplyr</code> packages to clean up data frames and calculate new variables. We will use the <code>broom</code> and <code>purr</code> packages to make the modelling of thousands of population trends more efficient. We will use the <code>ggplot2</code> package to make graphs, maps of occurrence records, and to visualise ppulation trends and then we will arrange all of our graphs together using the <code>gridExtra</code> package.</b></p>
<p>We will be working with population data from the <a href="http://www.livingplanetindex.org/home/index" target="_blank">Living Planet Database</a> and red deer occurrence data from the <a href="http://www.gbif.org/" target="_blank">Global Biodiversity Information Facility</a>, both of which are publicly available datasets.</p>
<p><strong>First, we will model population change for vertebrate forest species to see whether greater population change is found for longer duration studies.</strong></p>
<p><strong>Because we have created a version-controlled <code>R</code> project using the repository for the workshop, we are already in the right working directory, i.e. the folder that contains all the data and other files, thus there is no need for us to set a working directory at the start of the script, unless we explicitly want to change it for some reason.</strong></p>
<p>Here are the packages we need. Note that not all <code>tidyverse</code> packages load automatically with <code>library(tidyverse)</code> - only the core ones do, so you need to load <code>broom</code> separately. If you don&rsquo;t have some of the packages installed, you can install them using <code>ìnstall.packages(&quot;package-name&quot;)</code>.</p>
<pre><code class="language-r"># Packages ----
library(tidyverse) # Hadley Wickham's tidyverse - the theme of this tutorial
library(broom) # To summarise model outputs
library(ggExtra) # To make pretty graphs - addon package to ggplot2
library(maps) # To make pretty maps - warning: maps masks map from purr!
library(RColorBrewer) # To make pretty colours
library(gridExtra) # To arrange multi-plot panels
</code></pre>
<p>If you&rsquo;ve ever tried to perfect your <code>ggplot2</code> graphs, you might have noticed that the lines starting with <code>theme()</code> quickly pile up: you adjust the font size of the axes and the labels, the position of the title, the background colour of the plot, you remove the grid lines in the background, etc. And then you have to do the same for the next plot, which really increases the amount of code you use. Here is a simple solution: create a customised theme that combines all the <code>theme()</code> elements you want and apply it to your graphs to make things easier and increase consistency. You can include as many elements in your theme as you want, as long as they don&rsquo;t contradict one another and then when you apply your theme to a graph, only the relevant elements will be considered - e.g. for our graphs we won&rsquo;t need to use <code>legend.position</code>, but it&rsquo;s fine to keep it in the theme in case any future graphs we apply it to do have the need for legends.</p>
<pre><code class="language-r"># Setting a custom ggplot2 function ---
# *** Functional Programming ***
# This function makes a pretty ggplot theme
# This function takes no arguments!
theme_LPD &lt;- function(){
theme_bw()+
theme(axis.text.x = element_text(size = 12, vjust = 1, hjust = 1),
axis.text.y = element_text(size = 12),
axis.title.x = element_text(size = 14, face = &quot;plain&quot;),
axis.title.y = element_text(size = 14, face = &quot;plain&quot;),
panel.grid.major.x = element_blank(),
panel.grid.minor.x = element_blank(),
panel.grid.minor.y = element_blank(),
panel.grid.major.y = element_blank(),
plot.margin = unit(c(0.5, 0.5, 0.5, 0.5), units = , &quot;cm&quot;),
plot.title = element_text(size = 20, vjust = 1, hjust = 0.5),
legend.text = element_text(size = 12, face = &quot;italic&quot;),
legend.title = element_blank(),
legend.position = c(0.5, 0.8))
}
</code></pre>
<h3 id="load-population-trend-data">Load population trend data</h3>
<p><strong>The data are in a <code>.RData</code> format, as those are quicker to use, since <code>.Rdata</code> files are more compressed. Of course, a drawback is that <code>.RData</code> files can only be used within R, whereas <code>.csv</code> files are more transferable.</strong></p>
<pre><code class="language-r"># Load data ----
load(&quot;LPDdata_Feb2016.RData&quot;)
# Inspect data ----
head(LPDdata_Feb2016)
</code></pre>
<p><center> <img src="https://BES-QSIG.github.io/courses/advancingr/wide.png" alt="Img" style="width: 600px;"/> </center></p>
<p>At the moment, each row contains a population that has been monitored over time and towards the right of the data frame there are lots of columns with population estimates for each year. To make this data &ldquo;tidy&rdquo; (one column per variable) we can use <code>gather()</code> to transform the data so there is a new column containing all the years for each population and an adjacent column containing all the population estimates for those years.</p>
<p>This takes our original dataset <code>LPIdata_Feb2016</code> and creates a new column called <code>year</code>, fills it with column names from columns <code>26:70</code> and then uses the data from these columns to make another column called <code>pop</code>.</p>
<pre><code class="language-r"># Format data for analysis ----
# Transform from wide to long format usign gather (opposite is spread)
# *** gather() function from the dplyr package in the tidyverse ***
LPD_long &lt;- gather(data = LPDdata_Feb2016, key = &quot;year&quot;, value = &quot;pop&quot;, select = 26:70)
</code></pre>
<p>Because column names are coded in as characters, when we turned the column names (<code>1970</code>, <code>1971</code>, <code>1972</code>, etc.) into rows, R automatically put an <code>X</code> in front of the numbers to force them to remain characters. We don&rsquo;t want that, so to turn <code>year</code> into a numeric variable, use the <code>parse_number()</code> function from the <code>readr</code> package. We can also make all the column names lowercase and remove some of the funky characters in the country column - strange characters mess up things in general, e.g. when you want to save files, push them to GitHub, etc.</p>
<pre><code class="language-r"># Get rid of the X in front of years
# *** parse_number() from the readr package in the tidyverse ***
LPD_long$year &lt;- parse_number(LPD_long$year)
# Rename variable names for consistency
names(LPD_long)
names(LPD_long) &lt;- tolower(names(LPD_long))
names(LPD_long)
# Create new column with genus and species together
LPD_long$species.name &lt;- paste(LPD_long$genus, LPD_long$species, sep = &quot; &quot;)
# Get rid of strange characters like &quot; / &quot;
LPD_long$country.list &lt;- gsub(&quot;,&quot;, &quot;&quot;, LPD_long$country.list, fixed = TRUE)
LPD_long$biome &lt;- gsub(&quot;/&quot;, &quot;&quot;, LPD_long$biome, fixed = TRUE)
# Examine the tidy data frame
head(LPD_long)
</code></pre>
<p><center> <img src="https://BES-QSIG.github.io/courses/advancingr/long.png" alt="Img" style="width: 600px;"/> </center></p>
<p>Now that our dataset is <em>tidy</em> we can get it ready for our analysis. We want to only use populations that have more than 5 years of data to make sure our analysis has enough data to capture population change. We should also scale the population data, because since the data come from many species, the units and magnitude of the data are very different - imagine tiny fish whose abundance is in the millions, and large carnivores whose abundance is much smaller. Scaling also normalises the data, as later on we will be using linear models assuming a normal distribution. To do all of this in one go, we can use pipes.</p>
<p><strong>Pipes (<code>%&gt;%</code>) are a way of streamlining data manipulation - imagine all of your data coming in one end of the pipe, while they are in there, they are manipulated, summarised, etc., then the output (e.g. your new data frame or summary statistics) comes out the other end of the pipe. At each step of the pipe processing, the pipe is using the ouput of the previous step.</strong></p>
<pre><code class="language-r"># Data manipulation ----
# *** piping from from dplyr
LPD_long2 &lt;- LPD_long %&gt;%
# Remove duplicate rows
# *** distinct() function from dplyr
distinct(LPD_long) %&gt;%
# remove NAs in the population column
# *** filter() function from dplyr
filter(is.finite(pop)) %&gt;%
# Group rows so that each group is one population
# *** group_by() function from dplyr
group_by(id) %&gt;%
# Make some calculations
# *** mutate() function from dplyr
mutate(maxyear = max(year), minyear = min(year),
# Calculate duration
duration = maxyear - minyear,
# Scale population trend data
scalepop = (pop - min(pop))/(max(pop) - min(pop))) %&gt;%
# Keep populations with &gt;5 years worth of data and calculate length of monitoring
filter(is.finite(scalepop),
length(unique(year)) &gt; 5) %&gt;%
# Remove any groupings you've greated in the pipe
ungroup()
</code></pre>
<p>Now we can explore our data a bit. Let&rsquo;s create a few basic summary statistics for each biome and store them in a new data frame:</p>
<pre><code class="language-r"># Calculate summary statistics for each biome
LPD_biome_sum &lt;- LPD_long2 %&gt;%
# Group by biome
group_by(biome) %&gt;%
# Create columns, number of populations
# *** summarise()/summarize() function from dplyr in the tidyverse ***
summarise(populations = n(),
# Calculate the mean study length
mean_study_length_years = mean(duration),
# Model sampling method
dominant_sampling_method = names(which.max(table(sampling.method))),
# Model unit type
dominant_units = names(which.max(table(units)))) %&gt;%
# Remove any groupings you've greated in the pipe
ungroup()
# Take a look at some of the records
head(LPD_biome_sum)
</code></pre>
<p>Next we will explore how populations from two of these biomes, temperate coniferous and temperate broadleaf forests, have changed over the monitoring duration. We will make the <code>biome</code> variable a factor (before it is just a character variable), so that later on we can make graphs based on the two categories (coniferous and broadleaf forests). We&rsquo;ll use the <code>filter()</code> function from <code>dplyr</code> to subset the data to just the forest species.</p>
<pre><code># Subset to just temperate forest species -----
# Notice the difference between | and &amp; when filtering
# | is an &quot;or&quot; whereas &amp; is &quot;and&quot;, i.e. both conditions have to be met
# at the same time
LPD_long2$biome &lt;- as.factor(LPD_long2$biome)
LPD.forest &lt;- filter(LPD_long2, biome == &quot;Temperate broadleaf and mixed forests&quot; |
biome == &quot;Temperate coniferous forests&quot;)
</code></pre>
<p>Before running models, it&rsquo;s a good idea to visualise our data to explore what kind of distribution we are working with.</p>
<p>The <code>gg</code> in <code>ggplot2</code> stands for grammar of graphics. Writing the code for your graph is like constructing a sentence made up of different parts that logically follow from one another. In a data visualisation context, the different elements of the code represent layers - first you make an empty plot, then you add a layer with your data points, then your measure of uncertainty, the axis labels and so on.</p>
<p><b> When using <code>ggplot2</code>, you usually start your code with <code>ggplot(your_data, aes(x = independent_variable, y = dependent_variable))</code>, then you add the type of plot you want to make using <code>+ geom_boxplot()</code>, <code>+ geom_histogram()</code>, etc. <code>aes</code> stands for aesthetics, hinting to the fact that using <code>ggplot2</code> you can make aesthetically pleasing graphs - there are many <code>ggplot2</code> functions to help you clearly communicate your results, and we will now go through some of them.</b></p>
<p><b>When we want to change the colour, shape or fill of a variable based on another variable, e.g. colour-code by species, we include <code>colour = species</code> inside the <code>aes()</code> function. When we want to set a specific colour, shape or fill, e.g. <code>colour = &quot;black&quot;</code>, we put that outside of the <code>aes()</code> function.</b></p>
<p>We will see our custom theme <code>theme_LPD()</code> in action as well!</p>
<pre><code class="language-r"># Data visualisation ----
# Data distribution - a histogram
(forest.hist &lt;- ggplot(LPD.forest, aes(x = scalepop)) +
geom_histogram(aes(fill = biome),
position = &quot;identity&quot;, colour = &quot;grey40&quot;) +
geom_vline(aes(xintercept = mean(scalepop)), # Adding a line for mean abundance
colour = &quot;darkred&quot;, linetype = &quot;dashed&quot;, size = 1) +
scale_fill_manual(values = c(&quot;#66CD00&quot;, &quot;#53868B&quot;)) +
theme_LPD() +
labs(title = &quot;a) Data distribution\n&quot;, x = &quot;\nScaled population size&quot;,
y = &quot;Count\n&quot;) +
# \n adds a blank line
guides(fill = F)) # Hiding the legend - this will be a two plot panel
# thus we don't need the same legend twice
</code></pre>
<p>Next up we can explore for how long populations have been monitored in the two biomes using a density histogram.</p>
<pre><code class="language-r"># Density histogram of duration of studies in the two biomes
(duration.forests &lt;- ggplot(LPD.forest, aes(duration, colour = biome)) +
stat_density(geom = &quot;line&quot;, size = 2, position = &quot;identity&quot;) +
theme_LPD() +
scale_colour_manual(values = c(&quot;#66CD00&quot;, &quot;#53868B&quot;)) +
labs(x = &quot;\nYears&quot;, y = &quot;Density\n&quot;, title = &quot;b) Monitoring duration\n&quot;))
</code></pre>
<p>We&rsquo;ll use the <code>grid.arrange</code> function from the <code>gridExtra</code> package to combine the two plots in a panel. You can specify the number of columns using <code>ncol =</code> and the number of rows using <code>nrow =</code>.</p>
<pre><code class="language-r"># Arrange in a panel and save
forest.panel &lt;- grid.arrange(forest.hist, duration.forests, ncol = 2)
ggsave(forest.panel, file = &quot;forest_panel.png&quot;, height = 5, width = 10)
</code></pre>
<p><center> <img src="https://BES-QSIG.github.io/courses/advancingr/forest_panel.png" alt="Img" style="width: 900px;"/> </center></p>
<p>We are now ready to model how each population has changed over time. There are 1785 populations, so with this one code chunk, we will run 1785 models and tidy up their outputs. You can read through the line-by-line comments to get a feel for what each line of code is doing.</p>
<p><strong>One specific thing to note is that when you add the <code>lm()</code> function in a pipe, you have to add <code>data = .</code>, which means use the outcome of the previous step in the pipe for the model.</strong></p>
<pre><code class="language-r"># Calculate population change for each forest population
# 1785 models in one go!
# Using a pipe
forest.slopes &lt;- LPD.forest %&gt;%
# Group by the key variables that we want to interate over
group_by(decimal.latitude, decimal.longitude, class, species.name, id, duration, location.of.population) %&gt;%
# Create a linear model for each group
do(mod = lm(scalepop ~ year, data = .)) %&gt;%
# Extract model coefficients using tidy() from the
# *** tidy() function from the broom package ***
tidy(mod) %&gt;%
# Filter out slopes and remove intercept values
filter(term == &quot;year&quot;) %&gt;%
# Get rid of the column term as we don't need it any more
# *** select() function from dplyr in the tidyverse ***
dplyr::select(-term) %&gt;%
# Remove any groupings you've greated in the pipe
ungroup()
</code></pre>
<p>We are ungrouping at the end of our pipe just because otherwise the object remains grouped and later on that might cause problems, if we forget about it.</p>
<p><strong>Now we can visualise the outputs of all our models and see how they vary based on study duration. We will add density histograms along the margins of the graph which makes for a more informative graph using the <code>ggMarginal()</code> function from the <code>ggExtra</code> package. Note that <code>ggExtra</code> is also an addin in <code>RStudio</code>, so for future reference, if you select some <code>ggplot2</code> code, then click on <code>Addins/ggplot2 Marginal plots</code> (the menu is in the middle top part of the screen), you can customise marginal histograms and the code gets automatically generated.</strong></p>
<pre><code class="language-r"># Visualising model outputs ----
# Plotting slope estimates and standard errors for all populations and adding histograms along the margins
(all.slopes &lt;- ggplot(forest.slopes, aes(x = duration, y = estimate)) +
geom_pointrange(aes(ymin = estimate - std.error,
ymax = estimate + std.error),
alpha = 0.3, size = 0.3) +
geom_hline(yintercept = 0, linetype = &quot;dashed&quot;) +
theme_LPD() +
ylab(&quot;Population change\n&quot;) +
xlab(&quot;\nDuration (years)&quot;))
(density.slopes &lt;- ggExtra::ggMarginal(
p = all.slopes,
type = 'density',
margins = 'both',
size = 5,
col = 'gray40',
fill = 'gray'
))
# Save the plot
ggsave(density.slopes, filename = &quot;slopes_duration.png&quot;, height = 6, width = 6)
</code></pre>
<p><center> <img src="https://BES-QSIG.github.io/courses/advancingr/slopes_duration-2.png" alt="Img" style="width: 600px;"/> </center></p>
<p><a name="pipes"></a></p>
<h2 id="2-using-pipes-to-make-figures-with-large-datasets">2. Using pipes to make figures with large datasets</h2>
<p>How to print plots of population change for multiple taxa</p>
<ol>
<li>How to set up file paths and folders in R</li>
<li>How to use a pipe to plot many plots by taxa</li>
<li>How to use the purrr package and functional programming</li>
</ol>
<p><strong>In the next part of the tutorial, we will focus on automating iterative actions, for example when we want to create the same type of graph for different subsets of our data. In our case, we will make histograms of the population change experienced by different vertebrate taxa in forests. When making multiple graphs at once, we have to specify the folder where they will be saved first:</strong></p>
<pre><code class="language-r"># PART 2: Using pipes to make figures with large datasets ----
# Make histograms of slope estimates for each taxa -----
# Set up new folder for figures
# Set path to relevant path on your computer/in your repository
path1 &lt;- &quot;Taxa_Forest_LPD/&quot;
# Create new folder
dir.create(path1)
</code></pre>
<p>There isn&rsquo;t a right answer here, there are different ways to achieve the same result and you can decide which one works best for your workflow. First we will use <code>dplyr</code> and pipes <code>%&gt;%</code>. Since we want one graph per taxa, we are going to group by the <code>class</code> variable. You can add functions that are not part of the <code>dplyr</code> package to pipes using <code>do</code> - in our case, we are saying that we want <code>R</code> to do our requested action (making and saving the histograms) for each taxa.</p>
<pre><code class="language-r"># First we will do this using dplyr and a pipe
forest.slopes %&gt;%
# Select the relevant data
dplyr::select(id, class, species.name, estimate) %&gt;%
# Group by taxa
group_by(class) %&gt;%
# Save all plots in new folder
do(ggsave(ggplot(., aes(x = estimate)) +
# Add histograms
geom_histogram(colour = &quot;darkgreen&quot;, fill = &quot;darkgreen&quot;, binwidth = 0.02) +
# Use custom theme
theme_LPD() +
# Add axis lables
xlab(&quot;Rate of population change (slopes)&quot;),
# Set up file names to print to
filename = gsub(&quot;&quot;, &quot;&quot;, paste0(path1, unique(as.character(.$class)),
&quot;.pdf&quot;)), device = &quot;pdf&quot;))
</code></pre>