-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path8 - Human exploitation threat.R
67 lines (50 loc) · 3.25 KB
/
8 - Human exploitation threat.R
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
# Supplementary code for Short et al. Part 8 - proportions of medicinal species subject to a threat from human exploitation
# Monica Short, August 2020
#load packages
library(rgdal)
library(tidyverse)
library(gridExtra)
library(ggplot2)
#set working directory
setwd("~/Documents/Short")
getwd()
#read in data
use.data<- read.csv("./Shortdata.csv")
#filter to medicinal use species
med <- use.data[which(use.data$useTradeId..30 =="TRUE"),]
obsnum <- nrow(med)
#join by id column
##------------------------------------------------------------------------------
## Species with a threat of human exploitation
##------------------------------------------------------------------------------
#Human exploitation threats
Human <- med[which(med$hasHumanExploitationThreat == "TRUE"),]
Humannum <- nrow(Human)
Humanper <- round((Humannum/obsnum * 100), digits = 2)
NonHuman <- med[which(med$hasHumanExploitationThreat == "FALSE"),]
NonHumannum <- nrow(NonHuman)
NonHumanper <- round((NonHumannum/obsnum * 100), digits = 2)
#Med only human exploitation threat
Medonly <- med[which(med$useTradeId..19 =="FALSE" & med$useTradeId..23 == "FALSE" & med$useTradeId..23 == "FALSE" & med$useTradeId..27 == "FALSE" & med$useTradeId..20 =="FALSE" & med$useTradeId..32 =="FALSE" & med$useTradeId..24 =="FALSE" & med$useTradeId..29 =="FALSE" & med$useTradeId..33 =="FALSE" & med$useTradeId..25 =="FALSE" & med$useTradeId..28 =="FALSE" & med$useTradeId..22 =="FALSE" & med$useTradeId..21 =="FALSE" & med$useTradeId..35 =="FALSE" & med$useTradeId..36 =="FALSE" & med$useTradeId..34 =="FALSE" & med$useTradeId..31 =="FALSE"),]
Medonly <- Medonly[!duplicated(Medonly$scientific_name),]
Medonlynum <- nrow(Medonly)
Medonlyper <-round((Medonlynum/obsnum * 100), digits = 2)
MedHuman <- Medonly[which(Medonly$hasHumanExploitationThreat == "TRUE"),]
MedHumannum <- nrow(MedHuman)
MedHumanper <- round((MedHumannum/Medonlynum * 100), digits = 2)
#Mixed use human exploitation threat
Mixed <- med[which(med$useTradeId..19 =="TRUE" | med$useTradeId..23 == "TRUE" | med$useTradeId..23 == "TRUE" | med$useTradeId..27 == "TRUE" | med$useTradeId..20 =="TRUE" | med$useTradeId..32 =="TRUE" | med$useTradeId..24 =="TRUE" | med$useTradeId..29 =="TRUE" | med$useTradeId..33 =="TRUE" | med$useTradeId..25 =="TRUE" | med$useTradeId..28 =="TRUE" | med$useTradeId..22 =="TRUE" | med$useTradeId..21 =="TRUE" | med$useTradeId..35 =="TRUE" | med$useTradeId..36 =="TRUE" | med$useTradeId..34 =="TRUE" | med$useTradeId..31 =="TRUE"),]
Mixednum <- nrow(Mixed)
Mixedper <- round((Mixednum/obsnum * 100), digits = 2)
MixHuman <- Mixed[which(Mixed$hasHumanExploitationThreat == "TRUE"),]
MixHumannum <- nrow(MixHuman)
MixHumanper <- round((MixHumannum/Mixednum * 100), digits = 2)
#At-risk species wiht threat of human exploitation
Endanger <- use_clean[which(use_clean$redListCategoryTitle =="Endangered" | use_clean$redListCategoryTitle =="Critically Endangered" | use_clean$redListCategoryTitle =="Vulnerable"),]
MedEnd <- Endanger[which(Endanger$useTradeId..30 =="TRUE"),]
MedEndnum <- nrow(MedEnd)
Mednum <- nrow(med)
MedEndPer <-round((MedEndnum/Mednum * 100), digits = 2)
MedEndHuman <- MedEnd[which(MedEnd$hasHumanExploitationThreat == "TRUE"),]
MedEndHumannum <- nrow(MedEndHuman)
MedEndHumanper <- round((MedEndHumannum/MedEndnum * 100), digits = 2)