library(DivInsight)
data("Colombia")
This is an introduction to the ‘DivInsight’ package.
We use ‘DivInsight’ to repurpose historical occurrence taxon data for further analysis.
Included in the package is the Colombia dataset, which contains
occurrence data for the taxon ‘Formicidae’ at the Family level from 2000
to 2023. This data was queried from the Global Biodiversity Information
Facility (GBIF) database using the rgbif
package.
Each row of the occurrence dataframe has data for one observed individual. The dataset has many variables but the most important ones for the functions in this package pertain to taxa names, coordinate location, and dates of the observations.
head(Colombia[c(2:4, 31:32, 45)], 10)
#> # A tibble: 10 × 6
#> scientificName decimalLatitude decimalLongitude family genus eventDate
#> <chr> <dbl> <dbl> <chr> <chr> <chr>
#> 1 Hylomyrma transversa… 2.18 -71.2 Formi… Hylo… 2000-01-…
#> 2 Carebara Westwood, 1… 4.53 -75.6 Formi… Care… 2000-01-…
#> 3 Dolichoderus bispino… 2.18 -73.8 Formi… Doli… 2000-01-…
#> 4 Cephalotes marginatu… 0.0667 -72.4 Formi… Ceph… 2000-01-…
#> 5 Pheidole Westwood, 1… 4.36 -75.7 Formi… Phei… 2000-01-…
#> 6 Pheidole Westwood, 1… 4.36 -75.7 Formi… Phei… 2000-01-…
#> 7 Pheidole Westwood, 1… 4.36 -75.7 Formi… Phei… 2000-01-…
#> 8 Pheidole Westwood, 1… 4.36 -75.7 Formi… Phei… 2000-01-…
#> 9 Pheidole Westwood, 1… 4.36 -75.7 Formi… Phei… 2000-01-…
#> 10 Pheidole Westwood, 1… 0.248 -72.9 Formi… Phei… 2000-01-…
We can subset the Colombia dataset then perform the most important
function in the package clusterise_sites()
to cluster data
by date and produce centered coordinates for each cluster.
These clusters of data can be considered sites.
# subset the dataframe by province name
<- subset(Colombia, stateProvince == "Meta")
Colombia_Meta
# cluster occurrence data by date and generate centred coordinates for each site
<- clusterise_sites(
clusterised_Meta
dataframe = Colombia_Meta,
cluster_min_length = 30
)
Once the data has been ‘clusterised’ a dataframe, where each row
pertains to a site, can be produced by using
generate_stats()
. This information includes date of
observations, centred coordinates, and diversity indices. These indices
include Species Richness (S), Shannon Diversity (H), Simpson Diversity
(D), Inverse Simpson (Dinv), Margalef’s Diversity (d), and Pielou’s
Evenness (J).
# generate stats
<- generate_stats(clusterised_Meta)
stats_Meta
# view the stats table
print(stats_Meta)
#> longitude latitude site_group date year month day country
#> 1 -73.46702 4.058576 1 2000-10-01 2000 10 1 Colombia
#> 2 -73.46702 4.058576 1 2000-10-06 2000 10 6 Colombia
#> 3 -71.71407 4.322192 1 2012-05-01 2012 5 1 Colombia
#> 4 -72.96847 4.295741 1 2013-02-10 2013 2 10 Colombia
#> 5 -72.96847 4.295741 1 2013-02-11 2013 2 11 Colombia
#> 6 -72.96847 4.295741 1 2013-02-12 2013 2 12 Colombia
#> 7 -72.96847 4.295741 1 2013-02-13 2013 2 13 Colombia
#> 8 -72.97906 4.287842 1 2013-02-15 2013 2 15 Colombia
#> 9 -72.97054 4.288258 1 2013-02-16 2013 2 16 Colombia
#> 10 -72.97906 4.287842 1 2013-02-17 2013 2 17 Colombia
#> 11 -72.97466 4.285456 1 2013-02-18 2013 2 18 Colombia
#> 12 -72.96518 4.273713 1 2013-02-21 2013 2 21 Colombia
#> 13 -72.96660 4.272737 1 2013-02-22 2013 2 22 Colombia
#> 14 -72.96733 4.273370 1 2013-02-23 2013 2 23 Colombia
#> 15 -72.97047 4.275363 1 2013-02-24 2013 2 24 Colombia
#> 16 -72.96566 4.458016 1 2013-03-03 2013 3 3 Colombia
#> 17 -72.96566 4.458016 1 2013-03-04 2013 3 4 Colombia
#> 18 -72.96566 4.458016 1 2013-03-05 2013 3 5 Colombia
#> 19 -72.96566 4.458016 1 2013-03-06 2013 3 6 Colombia
#> 20 -72.96038 4.401621 1 2013-03-08 2013 3 8 Colombia
#> 21 -72.96413 4.403583 1 2013-03-09 2013 3 9 Colombia
#> 22 -72.96038 4.401621 1 2013-03-10 2013 3 10 Colombia
#> 23 -72.81086 4.357411 1 2013-03-11 2013 3 11 Colombia
#> 24 -72.97800 4.445970 1 2013-03-13 2013 3 13 Colombia
#> 25 -72.97800 4.445970 1 2013-03-14 2013 3 14 Colombia
#> 26 -72.97800 4.445970 1 2013-03-15 2013 3 15 Colombia
#> 27 -72.97800 4.445970 1 2013-03-16 2013 3 16 Colombia
#> 28 -71.81433 4.530222 1 2015-09-16 2015 9 16 Colombia
#> 29 -72.36711 4.377956 1 2015-10-13 2015 10 13 Colombia
#> 30 -73.06123 4.134214 1 2015-11-19 2015 11 19 Colombia
#> 31 -73.06123 4.134213 1 2016-02-15 2016 2 15 Colombia
#> 32 -73.20257 4.042752 1 2016-02-20 2016 2 20 Colombia
#> 33 -72.91989 4.225658 1 2016-02-24 2016 2 24 Colombia
#> 34 -73.58081 4.077551 1 2016-03-21 2016 3 21 Colombia
#> 35 -73.61314 4.094075 1 2016-04-12 2016 4 12 Colombia
#> 36 -73.47471 4.073413 1 2016-05-24 2016 5 24 Colombia
#> 37 -73.47267 4.073333 1 2016-06-13 2016 6 13 Colombia
#> 38 -73.47267 4.073333 1 2016-08-03 2016 8 3 Colombia
#> 39 -72.02722 4.171914 1 2017-05-22 2017 5 22 Colombia
#> 40 -73.40181 3.531730 1 2017-08-28 2017 8 28 Colombia
#> 41 -73.40181 3.531730 1 2019-04-08 2019 4 8 Colombia
#> 42 -71.43081 3.814218 1 2021-06-26 2021 6 26 Colombia
#> 43 -71.39631 3.821191 1 2021-06-27 2021 6 27 Colombia
#> 44 -71.52242 3.857269 1 2021-06-29 2021 6 29 Colombia
#> 45 -73.58722 3.884813 1 2021-07-07 2021 7 7 Colombia
#> 46 -73.36824 4.083131 1 2022-11-09 2022 11 9 Colombia
#> 47 -73.38409 4.080567 1 2022-11-11 2022 11 11 Colombia
#> 48 -73.37865 4.091503 1 2022-11-14 2022 11 14 Colombia
#> stateProvince kingdom phylum class S H D Dinv
#> 1 Meta Animalia Arthropoda Insecta 6 1.4554681 0.72163265 3.592375
#> 2 Meta Animalia Arthropoda Insecta 14 1.9166250 0.79163828 4.799346
#> 3 Meta Animalia Arthropoda Insecta 39 3.2055799 0.93252811 14.820988
#> 4 Meta Animalia Arthropoda Insecta 39 3.0140953 0.92458580 13.260102
#> 5 Meta Animalia Arthropoda Insecta 38 3.0036330 0.92388605 13.138196
#> 6 Meta Animalia Arthropoda Insecta 36 2.9239033 0.91554923 11.841218
#> 7 Meta Animalia Arthropoda Insecta 29 2.6783249 0.89443445 9.472788
#> 8 Meta Animalia Arthropoda Insecta 46 2.8900896 0.89944368 9.944676
#> 9 Meta Animalia Arthropoda Insecta 38 2.8284995 0.90380918 10.396003
#> 10 Meta Animalia Arthropoda Insecta 36 2.8605812 0.90954877 11.055682
#> 11 Meta Animalia Arthropoda Insecta 40 2.9372944 0.90670360 10.718527
#> 12 Meta Animalia Arthropoda Insecta 41 3.0222843 0.91674944 12.011932
#> 13 Meta Animalia Arthropoda Insecta 37 3.0079504 0.92719723 13.735741
#> 14 Meta Animalia Arthropoda Insecta 28 2.8212660 0.91321303 11.522468
#> 15 Meta Animalia Arthropoda Insecta 32 2.9894666 0.92975386 14.235658
#> 16 Meta Animalia Arthropoda Insecta 41 2.9208988 0.90771986 10.836568
#> 17 Meta Animalia Arthropoda Insecta 34 2.8824013 0.89953361 9.953577
#> 18 Meta Animalia Arthropoda Insecta 23 2.7431849 0.91005291 11.117647
#> 19 Meta Animalia Arthropoda Insecta 29 2.8735577 0.91852679 12.273973
#> 20 Meta Animalia Arthropoda Insecta 26 2.8644476 0.91440114 11.682399
#> 21 Meta Animalia Arthropoda Insecta 29 2.8614421 0.91626298 11.942149
#> 22 Meta Animalia Arthropoda Insecta 22 2.7231352 0.90634755 10.677778
#> 23 Meta Animalia Arthropoda Insecta 24 2.6264652 0.88439688 8.650286
#> 24 Meta Animalia Arthropoda Insecta 29 2.7966825 0.90751038 10.812024
#> 25 Meta Animalia Arthropoda Insecta 23 2.4984047 0.88042624 8.363039
#> 26 Meta Animalia Arthropoda Insecta 29 2.6708233 0.89128837 9.198648
#> 27 Meta Animalia Arthropoda Insecta 37 2.8380258 0.90012856 10.012872
#> 28 Meta Animalia Arthropoda Insecta 24 2.6942649 0.91520000 11.792453
#> 29 Meta Animalia Arthropoda Insecta 41 3.1788165 0.93347953 15.032967
#> 30 Meta Animalia Arthropoda Insecta 46 2.9783477 0.89543679 9.563593
#> 31 Meta Animalia Arthropoda Insecta 23 2.7363603 0.92062958 12.599152
#> 32 Meta Animalia Arthropoda Insecta 44 2.8179889 0.87304462 7.876783
#> 33 Meta Animalia Arthropoda Insecta 34 2.9850803 0.91651056 11.977563
#> 34 Meta Animalia Arthropoda Insecta 26 2.9013485 0.93008091 14.302245
#> 35 Meta Animalia Arthropoda Insecta 20 2.6732659 0.91438763 11.680556
#> 36 Meta Animalia Arthropoda Insecta 14 2.4354516 0.89640441 9.652921
#> 37 Meta Animalia Arthropoda Insecta 16 2.5922425 0.91358025 11.571429
#> 38 Meta Animalia Arthropoda Insecta 14 2.4592217 0.89990817 9.990826
#> 39 Meta Animalia Arthropoda Insecta 28 2.6557610 0.89420647 9.452374
#> 40 Meta Animalia Arthropoda Insecta 3 0.2287207 0.09399167 1.103743
#> 41 Meta Animalia Arthropoda Insecta 2 0.3144922 0.17233560 1.208219
#> 42 Meta Animalia Arthropoda Insecta 19 2.6588110 0.91257244 11.438040
#> 43 Meta Animalia Arthropoda Insecta 22 2.9475759 0.93990930 16.641509
#> 44 Meta Animalia Arthropoda Insecta 59 3.7035920 0.96465093 28.289286
#> 45 Meta Animalia Arthropoda Insecta 44 3.6045092 0.96810019 31.348148
#> 46 Meta Animalia Arthropoda Insecta 54 3.7640463 0.97139200 34.955257
#> 47 Meta Animalia Arthropoda Insecta 57 3.7593478 0.96989166 33.213389
#> 48 Meta Animalia Arthropoda Insecta 31 3.2345501 0.95361578 21.559055
#> d J day_length
#> 1 1.4063321 0.8123122 12.08078
#> 2 2.5400578 0.7262537 12.06269
#> 3 8.2879541 0.8749900 12.27170
#> 4 6.8336946 0.8227227 11.96557
#> 5 7.0876395 0.8257215 11.96886
#> 6 6.9048454 0.8159307 11.97218
#> 7 5.5807132 0.7953934 11.97554
#> 8 7.7844658 0.7548603 11.98260
#> 9 6.6311454 0.7775760 11.98603
#> 10 6.5514433 0.7982604 11.98952
#> 11 7.4327847 0.7962566 11.99309
#> 12 7.6006754 0.8138483 12.00404
#> 13 7.0096209 0.8330154 12.00766
#> 14 5.6107576 0.8466665 12.01126
#> 15 6.3994225 0.8625777 12.01485
#> 16 7.5076820 0.7865469 12.03781
#> 17 6.7274519 0.8173870 12.04176
#> 18 5.3099890 0.8748812 12.04572
#> 19 5.9340906 0.8533725 12.04970
#> 20 5.3289589 0.8791782 12.05838
#> 21 6.3025429 0.8497745 12.06232
#> 22 5.0882763 0.8809763 12.06631
#> 23 5.1501283 0.8264382 12.07071
#> 24 5.9229327 0.8305426 12.07797
#> 25 4.7080689 0.7968137 12.08203
#> 26 5.7255626 0.7931656 12.08609
#> 27 7.0506041 0.7859569 12.09016
#> 28 4.4532339 0.8477719 12.14299
#> 29 7.3673703 0.8559997 12.03578
#> 30 8.1266541 0.7779124 11.92493
#> 31 4.0858056 0.8727046 11.98731
#> 32 7.6215364 0.7446743 12.00658
#> 33 6.4630537 0.8465046 12.01598
#> 34 5.5421810 0.8905042 12.11436
#> 35 4.6792924 0.8923581 12.19693
#> 36 3.2743184 0.9228491 12.32601
#> 37 4.1858297 0.9349539 12.35485
#> 38 3.7179957 0.9318561 12.28806
#> 39 4.7309407 0.7969982 12.32417
#> 40 0.5385650 0.2081906 12.19631
#> 41 0.2675464 0.4537163 12.16923
#> 42 3.7218674 0.9029941 12.34179
#> 43 4.7395325 0.9535863 12.34184
#> 44 9.8724568 0.9082913 12.34298
#> 45 9.5095114 0.9525181 12.33762
#> 46 10.9769172 0.9436103 11.95340
#> 47 11.5791430 0.9298294 11.94793
#> 48 6.9701548 0.9419226 11.93942
A chart can be produced to show date against diversity.
# plot trend charts
plot_sites_trend_H(clusterised_object = clusterised_Meta,
main_title = "Formicidae Diversity in the Meta Province")