title: “Final project Ben Amar Charaf Eddine” output: html_document —
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.
Ben Amar Charaf Eddine 8 April 2019
summary: the final project came with a goal of aplying the methods and the concepts we learned in class,during the course of Geomatics in this semester and ally those techniques on the domain of conservation management.in my project i will follow the first path of the work Multispecies preliminary conservation assessments from distribution data" and I will use the ConR package to realize that.my work will based on the question of “how it is the situation of an organism from geographicly dustributed data?”the path 1 oblige us to use the ConR package because it helps with on the large georaphical parametres by supplying libraries to execute process that deals with that.
library(sf)
## Linking to GEOS 3.5.1, GDAL 2.1.3, PROJ 4.9.2
library(raster)
## Loading required package: sp
library(tidyverse)
## ── Attaching packages ──────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.1.0 ✔ purrr 0.3.2
## ✔ tibble 2.1.1 ✔ dplyr 0.8.0.1
## ✔ tidyr 0.8.3 ✔ stringr 1.4.0
## ✔ readr 1.3.1 ✔ forcats 0.4.0
## ── Conflicts ─────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ tidyr::extract() masks raster::extract()
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ✖ dplyr::select() masks raster::select()
#install.packages("ConR")
library(sp)
library(ConR)
when I wanted to download the data I used the GBIF website it was a fantastic source to get huge data concerning the biodiversity field, I downloaded the data related to my specie and the country I have chosen through the rbig R package .i registered in the website and I have searched for some species that live in the Amazonia ,and then I have got the notification of the download, the link of downloading of the data I used is http://api.gbif.org/v1/occurrence/download/request/0045549-181108115102211.zip ,and through the upcoming process you will see how I implemented that and all the process of unzipping .
#install.packages("rgbif")
library(rgbif)
library(dplyr)
equ_gbif <- occ_download_get(key = "0045549-181108115102211", overwrite = TRUE) %>%
occ_download_import(equ_gbif_download, na.strings = c("", NA))
## Download file size: 2.99 MB
## On disk at /cloud/project/0045549-181108115102211.zip
equ_gbif
## # A tibble: 87,271 x 45
## gbifID datasetKey occurrenceID kingdom phylum class order family genus
## * <int> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 1.99e9 ad43e954-… MH306193 Animal… Chord… Amph… Anura Strab… Pris…
## 2 1.99e9 ad43e954-… MH306194 Animal… Chord… Amph… Anura Strab… Pris…
## 3 1.99e9 50c9509d-… https://www… Animal… Chord… Amph… Anura Phyll… Call…
## 4 1.99e9 50c9509d-… https://www… Animal… Chord… Amph… Anura Strab… Pris…
## 5 1.99e9 50c9509d-… https://www… Animal… Chord… Amph… Anura Lepto… Lept…
## 6 1.99e9 50c9509d-… https://www… Animal… Chord… Amph… Anura Hylid… Tepu…
## 7 1.99e9 50c9509d-… https://www… Animal… Chord… Amph… Anura Strab… Pris…
## 8 1.99e9 50c9509d-… https://www… Animal… Chord… Amph… Anura Hylid… Oste…
## 9 1.99e9 50c9509d-… https://www… Animal… Chord… Amph… Anura Dendr… Amee…
## 10 1.99e9 50c9509d-… https://www… Animal… Chord… Amph… Anura Strab… Pris…
## # … with 87,261 more rows, and 36 more variables: species <chr>,
## # infraspecificEpithet <chr>, taxonRank <chr>, scientificName <chr>,
## # countryCode <chr>, locality <chr>, publishingOrgKey <chr>,
## # decimalLatitude <dbl>, decimalLongitude <dbl>,
## # coordinateUncertaintyInMeters <dbl>, coordinatePrecision <lgl>,
## # elevation <dbl>, elevationAccuracy <dbl>, depth <dbl>,
## # depthAccuracy <dbl>, eventDate <chr>, day <int>, month <int>,
## # year <int>, taxonKey <int>, speciesKey <int>, basisOfRecord <chr>,
## # institutionCode <chr>, collectionCode <chr>, catalogNumber <chr>,
## # recordNumber <chr>, identifiedBy <chr>, dateIdentified <chr>,
## # license <chr>, rightsHolder <chr>, recordedBy <chr>, typeStatus <chr>,
## # establishmentMeans <chr>, lastInterpreted <chr>, mediaType <chr>,
## # issue <chr>
library(tidyverse)
equ_gbif %>% drop_na(kingdom) %>% count(kingdom, sort = TRUE)
## # A tibble: 1 x 2
## kingdom n
## <chr> <int>
## 1 Animalia 87271
equ_gbif %>% filter(taxonRank == "SPECIES") %>% count(species) %>% arrange(desc(n))
## # A tibble: 568 x 2
## species n
## <chr> <int>
## 1 Dendropsophus triangulum 4631
## 2 Dendropsophus carnifex 3764
## 3 Atelopus ignescens 2763
## 4 Pristimantis w-nigrum 2331
## 5 Pristimantis curtipes 1796
## 6 Pristimantis achatinus 1784
## 7 Pristimantis unistrigatus 1574
## 8 Rhinella margaritifera 1557
## 9 Epipedobates machalilla 1473
## 10 Hypsiboas punctatus 1408
## # … with 558 more rows
library(tidyverse)
equ_gbif %>% count(taxonRank)
## # A tibble: 6 x 2
## taxonRank n
## <chr> <int>
## 1 FAMILY 739
## 2 GENUS 8278
## 3 ORDER 102
## 4 SPECIES 78093
## 5 SUBSPECIES 57
## 6 VARIETY 2
equ_gbif %>% count(species, sort = TRUE) %>% drop_na(species) %>% filter(n > 500) %>%
ggplot(aes(x = reorder(species, n), y = n, fill = species)) + geom_bar(stat = "identity",
show.legend = FALSE) + labs(x = "SPECIES", y = "Number of Occurrence Records (observations)") +
coord_flip()
equ_gbif %>% filter(species == " Pristimantis lanthanites")
## # A tibble: 0 x 45
## # … with 45 variables: gbifID <int>, datasetKey <chr>, occurrenceID <chr>,
## # kingdom <chr>, phylum <chr>, class <chr>, order <chr>, family <chr>,
## # genus <chr>, species <chr>, infraspecificEpithet <chr>,
## # taxonRank <chr>, scientificName <chr>, countryCode <chr>,
## # locality <chr>, publishingOrgKey <chr>, decimalLatitude <dbl>,
## # decimalLongitude <dbl>, coordinateUncertaintyInMeters <dbl>,
## # coordinatePrecision <lgl>, elevation <dbl>, elevationAccuracy <dbl>,
## # depth <dbl>, depthAccuracy <dbl>, eventDate <chr>, day <int>,
## # month <int>, year <int>, taxonKey <int>, speciesKey <int>,
## # basisOfRecord <chr>, institutionCode <chr>, collectionCode <chr>,
## # catalogNumber <chr>, recordNumber <chr>, identifiedBy <chr>,
## # dateIdentified <chr>, license <chr>, rightsHolder <chr>,
## # recordedBy <chr>, typeStatus <chr>, establishmentMeans <chr>,
## # lastInterpreted <chr>, mediaType <chr>, issue <chr>
Pristimantis <- equ_gbif %>% dplyr::filter(genus == "Pristimantis") %>%
select(decimalLatitude, decimalLongitude, species)
print(Pristimantis)
## # A tibble: 20,781 x 3
## decimalLatitude decimalLongitude species
## <dbl> <dbl> <chr>
## 1 -0.03 -78.7 <NA>
## 2 -0.03 -78.7 <NA>
## 3 0.0530 -78.8 Pristimantis achatinus
## 4 -0.0156 -78.7 Pristimantis appendiculatus
## 5 -4.60 -78.8 <NA>
## 6 -2.07 -78.2 Pristimantis ganonotus
## 7 -1.10 -76.7 Pristimantis diadematus
## 8 -4.46 -78.8 Pristimantis katoptroides
## 9 -0.231 -78.4 Pristimantis unistrigatus
## 10 -0.728 -77.7 Pristimantis galdi
## # … with 20,771 more rows
library(rnaturalearth)
``