MultipleMeasure
MultipleMeasure.Rmd
read.csv(file = "../data-raw/IUCN Red List Changes - 2002 to 2022 - Single Measure.csv") -> Single_Measure
read.csv(file = "../data-raw/IUCN Red List Changes - 2002 to 2022 - Multiple Measures.csv") -> Multiple_Measure
head(Multiple_Measure)
## Year Mammal.Species.Assessed Bird.Species.Assessed Reptile.Species.Assessed
## 1 2022 5,969 11,162 10,150
## 2 2021 5,968 11,162 10,148
## 3 2020 5,940 11,158 8,492
## 4 2019 5,850 11,147 7,829
## 5 2018 5,692 11,126 7,127
## 6 2017 5,674 11,122 6,278
## Amphibian.Species.Assessed Fish.Species.Assessed Insect.Species.Assessed
## 1 7,316 24,356 12,161
## 2 7,296 22,581 12,100
## 3 7,212 22,005 10,865
## 4 6,794 19,199 8,696
## 5 6,722 16,803 8,037
## 6 6,609 16,409 7,639
## Mollusc.Species.Assessed Other.Invertebrate.Species.Assessed
## 1 9,017 5,403
## 2 9,019 5,395
## 3 8,847 5,267
## 4 8,749 5,243
## 5 8,627 5,222
## 6 8,413 5,078
## Plant.Species.Assessed Fungus...Protist.Species.Assessed
## 1 61,371 612
## 2 58,343 565
## 3 50,369 423
## 4 38,630 295
## 5 27,514 81
## 6 24,230 71
## Mammal.Species.Critically.Endangered Bird.Species.Critically.Endangered
## 1 232 231
## 2 229 225
## 3 221 223
## 4 203 225
## 5 201 224
## 6 202 222
## Reptile.Species.Critically.Endangered Amphibian.Species.Critically.Endangered
## 1 433 681
## 2 433 673
## 3 324 650
## 4 309 588
## 5 287 550
## 6 266 552
## Fish.Species.Critically.Endangered Insect.Species.Critically.Endangered
## 1 800 412
## 2 739 408
## 3 666 347
## 4 592 311
## 5 486 300
## 6 468 273
## Mollusc.Species.Critically.Endangered
## 1 717
## 2 717
## 3 682
## 4 667
## 5 633
## 6 625
## Other.Invertebrate.Species.Critically.Endangered
## 1 291
## 2 290
## 3 282
## 4 270
## 5 252
## 6 243
## Plant.Species.Critically.Endangered
## 1 5232
## 2 4976
## 3 4337
## 4 3229
## 5 2879
## 6 2722
## Fungus...Protist.Species.Critically.Endangered Mammal.Species..Endangered
## 1 36 549
## 2 32 547
## 3 30 539
## 4 19 505
## 5 14 482
## 6 10 476
## Bird.Species..Endangered Reptile.Species..Endangered
## 1 423 787
## 2 447 783
## 3 460 584
## 4 461 565
## 5 469 515
## 6 461 484
## Amphibian.Species..Endangered Fish.Species..Endangered
## 1 1103 1215
## 2 1085 1139
## 3 1036 1036
## 4 964 868
## 5 903 674
## 6 869 676
## Insect.Species..Endangered Mollusc.Species..Endangered
## 1 949 599
## 2 937 599
## 3 690 586
## 4 571 564
## 5 537 546
## 6 461 547
## Other.Invertebrate.Species..Endangered Plant.Species..Endangered
## 1 371 9996
## 2 370 9400
## 3 347 7925
## 4 344 5727
## 5 348 4537
## 6 340 4123
## Fungus...Protist.Species..Endangered Mammal.Species.Vulnerable
## 1 102 556
## 2 96 557
## 3 82 557
## 4 60 536
## 5 21 536
## 6 18 526
## Bird.Species.Vulnerable Reptile.Species.Vulnerable
## 1 755 625
## 2 773 623
## 3 798 541
## 4 800 535
## 5 799 505
## 6 786 465
## Amphibian.Species.Vulnerable Fish.Species.Vulnerable
## 1 731 1533
## 2 730 1454
## 3 704 1338
## 4 648 1214
## 5 639 1172
## 6 679 1242
## Insect.Species.Vulnerable Mollusc.Species.Vulnerable
## 1 930 1068
## 2 925 1069
## 3 811 1032
## 4 765 1019
## 5 700 1016
## 6 680 1015
## Other.Invertebrate.Species.Vulnerable Plant.Species.Vulnerable
## 1 729 9221
## 2 727 8959
## 3 712 8098
## 4 710 6818
## 5 708 5883
## 6 709 5660
## Fungus...Protist.Species.Vulnerable
## 1 152
## 2 142
## 3 127
## 4 91
## 5 24
## 6 21
Multiple_Measure %>%
rowwise() %>%
mutate(endangered = Mammal.Species.Critically.Endangered * Other.Invertebrate.Species.Critically.Endangered) %>%
summarize(mean_endangered = mean(endangered))
## # A tibble: 20 × 1
## mean_endangered
## <dbl>
## 1 67512
## 2 66410
## 3 62322
## 4 54810
## 5 50652
## 6 49086
## 7 43044
## 8 43681
## 9 43665
## 10 30184
## 11 25872
## 12 25608
## 13 24816
## 14 18612
## 15 18612
## 16 14018
## 17 13608
## 18 9882
## 19 11224
## 20 10679
SM_tree <- tnrs_match_names(names = "Mammal")
tol_subtree(ott_id = SM_tree$ott_id) -> Mammal_tree
SM_tree
## search_string unique_name approximate_match ott_id is_synonym flags
## 1 mammal Polinices TRUE 57536 FALSE
## number_matches
## 1 1
str( Mammal_tree)
## List of 4
## $ edge : int [1:63, 1:2] 64 64 64 64 64 64 64 64 64 64 ...
## $ tip.label : chr [1:63] "Polinices_sagamiensis_ott339996" "Polinices_uber_ott375602" "Polinices_peselephanti_ott375604" "Polinices_jukesii_ott375606" ...
## $ Nnode : int 1
## $ node.label: chr "Polinices ott57536"
## - attr(*, "class")= chr "phylo"
class( Mammal_tree)
## [1] "phylo"
class(SM_tree)
## [1] "match_names" "data.frame"
Ntip( Mammal_tree)
## [1] 63
plot.phylo(x = Mammal_tree, cex = 0.5)