library(bRacatus)
#> Registered S3 method overwritten by 'geojsonsf':
#> method from
#> print.geojson geojson
This tutorial aims to guide the user from the installation to the data visualisation of bRacatus. We will walk the user through two examples. The first example uses GIFT checklist data as reference regions. The second example uses range maps as reference regions. bRacatus allows users to input their own data or to obtain these data from online repositories. In this tutorial, we will show how to use GBIF-facilitated point data and checklists provided by GIFT. We will also show an example in which range maps are input by the user. We ran all tests in a computer with 8GB of RAM, the execution times of each function may vary depending on the computer configuration, as well as on the internet connection for the functions requesting data through an API.
install.packages ("bRacatus")
library (bRacatus)
1 - Obtaining, preparing and visualising the input data
<- getOcc ("Babiana tubulosa")
pts head (pts)[,c(1:4)]
Running time: ≈ 1s. Output: a data.frame containing georeferenced records from GBIF.
#> key scientificName decimalLatitude
#> 1 3343824623 Babiana tubulosa (Burm.f.) Ker Gawl. -33.76574
#> 2 3384109201 Babiana tubulosa (Burm.f.) Ker Gawl. -33.38380
#> 3 3384489311 Babiana tubulosa (Burm.f.) Ker Gawl. -33.38371
#> 4 3391685128 Babiana tubulosa (Burm.f.) Ker Gawl. -33.38560
#> 5 2856692924 Babiana tubulosa (Burm.f.) Ker Gawl. -33.20938
#> 6 2873756661 Babiana tubulosa (Burm.f.) Ker Gawl. -33.89511
#> decimalLongitude
#> 1 18.45574
#> 2 18.38214
#> 3 18.38219
#> 4 18.38250
#> 5 18.08737
#> 6 18.61828
plotOcc (pts)
#> Warning in wkt(obj): CRS object has no comment
Running time: ≈ 1s. Output: a map showing the occurrence points.
<- giftRegions ("Babiana tubulosa")
ref_reg
ref_reg#> $Presence
#> class : SpatialPolygonsDataFrame
#> features : 3
#> extent : 11.75274, 129, -35.19272, -13.68923 (xmin, xmax, ymin, ymax)
#> crs : +proj=longlat +datum=WGS84 +no_defs
#> variables : 22
#> names : entity_ID, geo_entity, point_x, point_y, area, x_min, x_max, y_min, y_max, suit_geo, suit_geo_rst, entity_class, entity_type, overlap_checked, overlap_glonaf_checked, ...
#> min values : 10526, Cape Provinces, 22.532481, -30.902179, 661495.380275, 11.71634462, 30.19264462, -35.192768, -24.76539484, 0, 0, Mainland, Botanical Country, 1, 1, ...
#> max values : 10918, Western Australia, 122.178368, -25.470892, 2670674.376922, 112.919724, 129.000015, -34.82199484, -13.68923, 1, 1, Mainland, Botanical Country, 1, 1, ...
#>
#> $Native
#> class : SpatialPolygonsDataFrame
#> features : 2
#> extent : 11.75274, 32.89044, -34.82199, -16.97359 (xmin, xmax, ymin, ymax)
#> crs : +proj=longlat +datum=WGS84 +no_defs
#> variables : 22
#> names : entity_ID, geo_entity, point_x, point_y, area, x_min, x_max, y_min, y_max, suit_geo, suit_geo_rst, entity_class, entity_type, overlap_checked, overlap_glonaf_checked, ...
#> min values : 10526, Cape Provinces, 22.532481, -30.902179, 661495.380275, 11.71634462, 30.19264462, -34.82199484, -24.76539484, 0, 0, Mainland, Botanical Country, 1, 1, ...
#> max values : 10646, Southern Africa, 22.534039, -25.486517, 2670674.376922, 16.48334462, 32.89044462, -34.82199484, -16.95279484, 0, 0, Mainland, Botanical Country, 1, 1, ...
#>
#> $Alien
#> class : SpatialPolygonsDataFrame
#> features : 1
#> extent : 112.9669, 129, -35.19272, -13.68923 (xmin, xmax, ymin, ymax)
#> crs : +proj=longlat +datum=WGS84 +no_defs
#> variables : 22
#> names : entity_ID, geo_entity, point_x, point_y, area, x_min, x_max, y_min, y_max, suit_geo, suit_geo_rst, entity_class, entity_type, overlap_checked, overlap_glonaf_checked, ...
#> value : 10918, Western Australia, 122.178368, -25.470892, 2525437.318199, 112.919724, 129.000015, -35.192768, -13.68923, 1, 1, Mainland, Botanical Country, 1, 1, ...
Running time: ≈ 3s. Output: a list with three SpatialPolygonsDataFrame objects, one containing all the features of the regions where the species is present, one containing only the regions where the species is known to be native, and the last one containing the regions where it is alien.
plotRefReg (ref_reg)
#> Warning in wkt(obj): CRS object has no comment
#> Warning in wkt(obj): CRS object has no comment
#> Warning in wkt(obj): CRS object has no comment
Running time: ≈ 2s. Output: a figure with three occurrence maps, showing the regions where the species is present, native and alien.
<- signalCalculation (ref_reg,pts,biogeo = TRUE) signals
Running time: ≈ 2s. Output: The data.frame of species occurrences with extra columns containing the location ID and presence signals for each point. If biogeo=TRUE, the data.frame also includes the nativeness and alienness indices.
Running time: ≈ 3s. Output: the dataFrame occID with an extra column containing the presence signals for each point. If biogeo=TRUE, the dataFrame also includes the nativeness and alienness indices.
2- Applying the models and visualising the results
<- accuracy (signals) acc
Running time: < 1s. Output: the dataFrame downloaded from GBIF containing the species occurrence information and an extra column indicating the estimated accuracy of each point.
<- biogeoStatus (signals) biogeo
Running time: < 1s. Output: the dataFrame downloaded from GBIF containing the species occurrence information and an extra column indicating the estimated biogeographical status of each point.
plotAccuracy (acc)
#> Warning in wkt(obj): CRS object has no comment
Running time: < 1s. Output: a map showing the accuracy of the records in a gradient from most likely false (0) to most likely true (1).
plotBiogeoStatus (biogeo)
#> Warning in wkt(obj): CRS object has no comment
Running time: < 1s. Output: a map showing the nativeness of the points in a gradient from most likely alien (0) to most likely native (1).
<- getOcc ("Phalanger orientalis") # Running time: ≈ 1s. pts2
Simulate points for visualisation purposes
<- data.frame(species=pts2$species,
pts2 decimalLongitude=pts2$decimalLongitude,
decimalLatitude=pts2$decimalLatitude,
origin="GBIF") # Running time: < 1s.
<- data.frame(species="Phalanger orientalis",
extra_points decimalLongitude=c(125.257,112.765,110.632,112.192,121.130,
142.607,126.877,164.761,109.036),
decimalLatitude=c(8.261,2.396,-1.518,-7.821,-20.655,-13.639,
-17.904,-20.671,12.938),
origin="Simulated") # Running time: < 1s.
<- rbind(pts2,extra_points) # Running time: < 1s.
pts3
plotOcc (pts3) # Running time: < 1s.
#> Warning in wkt(obj): CRS object has no comment
The range map for this species is part of the package as an example. The user can introduce their own range maps for other species.
<- Range_Phalanger_orientalis
ref_reg <- rangeMaps(ref_reg) # Running time: < 1s.
range_map_ref_reg plotRefReg (range_map_ref_reg) # Running time: < 1s.
<- signalCalculation (range_map_ref_reg,pts3,biogeo = TRUE) # Running time: ≈ 40s. signals_3
<- accuracy (signals_3) # Running time: < 1s.
acc <- biogeoStatus (signals_3) # Running time: < 1s. biogeo
plotAccuracy (acc, regional=T, reg.by="points", borders=F, col.features="gray80", col.bg="white", plot.range=T, range=Range_Phalanger_orientalis, box=T) # Running time: < 1s.
#> Warning in wkt(obj): CRS object has no comment
plotBiogeoStatus (biogeo, regional=T, reg.by="points", borders=F, col.features="gray80", col.bg="white", plot.range=T, range=Range_Phalanger_orientalis, box=T) # Running time: < 1s.
#> Warning in wkt(obj): CRS object has no comment