1 📝 Introduction

We will use the CITES Wildlife Trade Database in 2016 to visualize the countries Import and Export the most for wildLife products and how are they distributed. In addition, we will look the purpose of the Wild animal trading and how it related with different countries. Furthermore, we will figure out and demonstrate what is the most traded families. Finally, we will investigate Elephant trading. I hope this notebook is not only beginner tutorial for data science EDA, but also a message for stop wild life trading!

No Trading, No Killing !

Note: Not all the trade are for commercial purpose , there are tradings for Educational/Scientific/Zoo purpose

2 🧹 Data Cleaning

We will categories the data by the purpose, and re-code the Exporter and Importer country data name. In addition, we will convert the unit, such as kg to g, L to ml.

# Recode the purpose


wild$ppose <- ifelse(wild$Purpose=="B", "Breeding",

              ifelse( wild$Purpose=="E", "Educational",

                 ifelse ( wild$Purpose=="G", "Garden",

                 ifelse( wild$Purpose=="H", "Hunting",

                 ifelse ( wild$Purpose=="L", "Law",

                ifelse ( wild$Purpose=="M", "Medical",

                 ifelse( wild$Purpose=="R", "reintroduction to wild",

                 ifelse ( wild$Purpose=="P", "Personal",

                 ifelse ( wild$Purpose=="Q", "Circus",

                 ifelse( wild$Purpose=="S", "Scientific",

                 ifelse ( wild$Purpose=="T", "Commercial",

                 ifelse ( wild$Purpose=="Z", "Zoo",

                            "Unknown"))))))))))))



# Recode country



wild$Excountry <- ifelse(wild$Exporter %in% c("CN", "HK"), "China",

                 ifelse( wild$Exporter=="US", "USA",

                 ifelse ( wild$Exporter=="AE", "Unite Arab Emirates",

                 ifelse( wild$Exporter=="BE", "Belgium",

                 ifelse ( wild$Exporter=="CZ", "Czech Republic",

                ifelse ( wild$Exporter=="NL", "Netherlands",

                 ifelse( wild$Exporter=="ID", "Indonesia",

                 ifelse ( wild$Exporter=="IT", "Italy",

                 ifelse ( wild$Exporter=="SG", "Singerpore",

                 ifelse( wild$Exporter=="MY", "Malaysia",

                 ifelse ( wild$Exporter=="JP", "Japan",

                 ifelse ( wild$Exporter=="MG", "Madagascar",

                 ifelse ( wild$Exporter=="FR", "France",

                 ifelse ( wild$Exporter=="DE", "Germany",

                          ifelse ( wild$Exporter=="GB", "Britain",

                 ifelse ( wild$Exporter=="PE", "Peru",

                ifelse ( wild$Exporter=="DE", "Germany",

                          ifelse ( wild$Exporter=="ES", "Spain",

                 ifelse ( wild$Exporter=="ZW", "Zimbabwe",

                  ifelse ( wild$Exporter=="PH", "Philippines",

                 ifelse ( wild$Exporter=="MC", "Monaco",

                           ifelse ( wild$Exporter=="IL", "Israel",

                  ifelse ( wild$Exporter=="AR", "Argentina",

                 ifelse ( wild$Exporter=="GT", "Guatemala",

                           ifelse ( wild$Exporter=="KW", "Kuwait",

                 ifelse ( wild$Exporter=="DK", "Denmark",

                            ifelse ( wild$Exporter=="UY", "Uruguay",

                 ifelse ( wild$Exporter=="GE", "Geogria",

                           ifelse ( wild$Exporter=="PL", "Poland",

                 ifelse ( wild$Exporter=="TN", "Tunisia",

                                 ifelse ( wild$Exporter=="KE", "Kenya",

                 ifelse ( wild$Exporter=="NO", "Norway",

                           ifelse ( wild$Exporter=="UG", "Uganda",

                 ifelse ( wild$Exporter=="MA", "Morocco",

                                   ifelse ( wild$Exporter=="BS", "Bahamas",

                 ifelse ( wild$Exporter=="NP", "Nepal",

                           ifelse ( wild$Exporter=="IN", "India",

                 ifelse ( wild$Exporter=="NI", "Nicaragua",

                                  ifelse ( wild$Exporter=="PY", "Paraguay",

                 ifelse ( wild$Exporter=="AM", "Armenia",

                                   ifelse ( wild$Exporter=="TH", "Thailand",

                 ifelse ( wild$Exporter=="CA", "Canada",

                                  ifelse ( wild$Exporter=="NG", "Nigeria",

                 ifelse ( wild$Exporter=="MX", "Mexico",

                          

                                       ifelse ( wild$Exporter=="CM", "Cameroon",

                 ifelse ( wild$Exporter=="FJ", "Fiji",

                                  ifelse ( wild$Exporter=="ZA", "South Africa",

                 ifelse ( wild$Exporter=="JM", "Jamaica",

                           ifelse ( wild$Exporter=="AD", "Andorra",

                            wild$Exporter)))))))))))))))))))))))))))))))))))))))))))))))))





wild$Imcountry <- ifelse(wild$Importer %in% c("CN", "HK"), "China",

                 ifelse( wild$Importer=="US", "USA",

                 ifelse ( wild$Importer=="AE", "Unite Arab Emirates",

                 ifelse( wild$Importer=="BE", "Belgium",

                 ifelse ( wild$Importer=="CZ", "Czech Republic",

                ifelse ( wild$Importer=="NL", "Netherlands",

                 ifelse( wild$Importer=="ID", "India",

                 ifelse ( wild$Importer=="IT", "Italy",

                 ifelse ( wild$Importer=="SG", "Singerpore",

                 ifelse( wild$Importer=="MY", "Malaysia",

                 ifelse ( wild$Importer=="JP", "Japan",

                 ifelse ( wild$Importer=="MG", "Madagascar",

                 ifelse ( wild$Importer=="FR", "France",

                 ifelse ( wild$Importer=="DE", "Germany",

                          ifelse ( wild$Importer=="GB", "Britain",

                 ifelse ( wild$Importer=="PE", "Peru",

                ifelse ( wild$Importer=="DE", "Germany",

                          ifelse ( wild$Importer=="ES", "Spain",

                 ifelse ( wild$Importer=="ZW", "Zimbabwe",

                  ifelse ( wild$Importer=="PH", "Philippines",

                 ifelse ( wild$Importer=="MC", "Monaco",

                                        ifelse ( wild$Exporter=="IL", "Israel",

                  ifelse ( wild$Importer=="AR", "Argentina",

                 ifelse ( wild$Importer=="GT", "Guatemala",

                           ifelse ( wild$Importer=="KW", "Kuwait",

                 ifelse ( wild$Importer=="DK", "Denmark",

                                           ifelse ( wild$Importer=="UY", "Uruguay",

                 ifelse ( wild$Importer=="GE", "Geogria",

                           ifelse ( wild$Importer=="PL", "Poland",

                 ifelse ( wild$Importer=="TN", "Tunisia",

                                 ifelse ( wild$Importer=="KE", "Kenya",

                 ifelse ( wild$Importer=="NO", "Norway",

                           ifelse ( wild$Importer=="UG", "Uganda",

                 ifelse ( wild$Importer=="MA", "Morocco",

                                   ifelse ( wild$Importer=="BS", "Bahamas",

                 ifelse ( wild$Importer=="NP", "Nepal",

                           ifelse ( wild$Importer=="IN", "India",

                 ifelse ( wild$Importer=="NI", "Nicaragua",

                                  ifelse ( wild$Importer=="PY", "Paraguay",

                 ifelse ( wild$Importer=="AM", "Armenia",

                                   ifelse ( wild$Importer=="TH", "Thailand",

                 ifelse ( wild$Importer=="CA", "Canada",

                                  ifelse ( wild$Importer=="NG", "Nigeria",

                 ifelse ( wild$Importer=="MX", "Mexico",

                          

                                       ifelse ( wild$Importer=="CM", "Cameroon",

                 ifelse ( wild$Importer=="FJ", "Fiji",

                                  ifelse ( wild$Importer=="ZA", "South Africa",

                 ifelse ( wild$Importer=="JM", "Jamaica",

                           ifelse ( wild$Importer=="AD", "Andorra",

                            wild$Importer)))))))))))))))))))))))))))))))))))))))))))))))))



#convert the unit

wild$exquantity <- ifelse(wild$Unit %in% c("kg", "L", "l"), wild$Exporter.reported.quantity*1000, wild$Exporter.reported.quantity)


wild$imquantity <- ifelse(wild$Unit %in% c("kg", "L", "l"), wild$Importer.reported.quantity*1000, wild$Importer.reported.quantity)


#total quantity

wild$allq <- rowSums(wild[, c("exquantity", "imquantity")], na.rm=TRUE)

Sample Wild Life Trading Data

msample <- wild[,c("Year","App.","Taxon","Class","Order","Family","Genus",
                   "Term","ppose","Excountry","Imcountry","exquantity", "imquantity", "allq")]

head(msample, 100)%>% DT::datatable()

3 🌎 Geographical Analysis for WildLife Trading

In this section, we will take the top 15 Export Country and Import Country for WildLife trading and see how are they are geographically distributed in the world. In our work, because the quanity unit is not specified for some entries. so this distribution is just a general guide, could be deviated from the truth.

3.1 Overall Wildlife Export and Import Distribution

3.1.1 Density Plot of Export and Import

We use the calculated export and import quantity to plot the distributions.

#1. export
c1<- ggplot(wild, aes(x=exquantity))+ geom_histogram(binwidth=50, colour="white", fill="#fdd7eb", alpha=0.8)+ xlim(0,1500)+ylim(0,2500)+
  labs(title="Overall Export Distribution") + theme_minimal(base_size = 8)


c2<- ggplot(wild, aes(x=imquantity))+ geom_histogram(binwidth=50, colour="white", fill="#5ab8d6", alpha=0.8)+ xlim(0,1500)+ylim(0,1750)+
  labs(title="Overall Import Distribution") + theme_minimal(base_size = 8)


(c1+c2)

3.1.2 Scatter Plot for Import and Export

We explore the Import and Export quantity by the level of protectiveness of the species.

  • I the most protected species
  • II the second protected species
  • III the leaset protected species
  • N unknown
s1<- ggplot(wild, aes(x= exquantity, y=imquantity, color=App.)) +
     geom_point()+
     xlim(0,4000000)+
     ylim(0,4000000)+
     geom_rug(col="steelblue", alpha=0.1, size=1.5)+
     theme_minimal(base_size=8)

s1

3.1.3 Density Plot of Export and Import by Protected Species

atry<-  readPNG("/Users/fangya/HU/3.Kaggle/trade2016/panda1.png", native=TRUE)

d1<- ggplot(wild, aes(exquantity, fill=App.))+ annotation_raster(atry, xmin=40,xmax=60, ymin=0.1, ymax=Inf) +geom_density(alpha=0.6)+
    scale_fill_manual(values=c("#fdd7eb", "#5ab8d6","#d0eaeb","#fcebc8"))+
    theme_minimal(base_size=8) +xlim(0,60)+ labs(title="Overall Export Density by Species")



atry1<- readPNG("/Users/fangya/HU/3.Kaggle/trade2016/o.png", native=TRUE)
d2<- ggplot(wild, aes(imquantity, fill=App.))+ annotation_raster(atry1, xmin=40,xmax=60, ymin=0.00, ymax=Inf) + geom_density(alpha=0.6)+ 
     scale_fill_manual(values=c("#fdd7eb", "#5ab8d6","#d0eaeb", "#fcebc8"))+
    theme_minimal(base_size=8) +xlim(0,60) +labs(title="Overall Import Density by Species")
d1

d2

3.2 Top 15 WildLife Export Country

We group the Export quantity by countries and select the top 15. China has the most Export then followed by Argentina. Overall, Most Developing countries have heavy export, such as China, India, Malaysia and Nepal in Asia. and some African and South American countries. To our surprise, USA, Norway and Singerpore is among the Top export countries. Western Europe doesnt have much trade.

i1 <- filter(wild,  exquantity >0 & !is.na(Exporter))

icountry <- group_by(i1, Excountry )

ic2 <- dplyr::summarise(icountry,  count=n(), add=sum(exquantity, na.rm=TRUE))

ic2 <- arrange(ic2, desc(add))

ic20 <- ic2[1:15,]

ic20$iso3 <-countrycode(ic20$Excountry, "country.name.en", "iso3c")

p1 <- ggplot(ic20, aes(x=reorder(Excountry,add),y=add))+
      geom_bar(aes(y=add,fill=add),  stat="identity")+scale_fill_gradient(low="#fce6c8", high="#fdd7eb")+
       labs(x="Country", y="Count",
       title="WildLife Export Country Top 15")+ 
       theme(legend.position="none", axis.text.x = element_text(angle = 60, hjust = 1),
          panel.background = element_rect(fill="white")   ) #+ scale_x_continuous(breaks=year2$year)

p1

n <- joinCountryData2Map(ic2, joinCode="NAME", nameJoinColumn="Excountry")
## 34 codes from your data successfully matched countries in the map
## 72 codes from your data failed to match with a country code in the map
## 209 codes from the map weren't represented in your data
mapCountryData(n, nameColumnToPlot="add", mapTitle=" WildLife Export Country Map" , colourPalette = "negpos8")

3.3 Top 15 WildLife Import Country

China won again for the country Import the most wildlife. In the overall distribution, we can see the most import trade comes from Asia, Western Europe and North America, and few countries in South America. Couple sporadic countries in Africa.

# group the country

e1 <- filter(wild,  imquantity >0 & !is.na(Imcountry))

ecountry <- group_by(e1, Imcountry )

ec2 <- dplyr::summarise(ecountry, add=sum(imquantity, na.rm=TRUE), count=n())

ec2 <- arrange(ec2, desc(add))

ec20 <- ec2[1:15,]



#barchart

p2 <- ggplot(ec20, aes(x=reorder(Imcountry,add),y=add))+

  geom_bar(aes(y=add,fill=add), stat="identity")+scale_fill_gradient(low="#d0eaeb", high="#5ab8d6")+

  labs(x="Country", y="Quantity",

       title="WildLife Import Country Top 25")+ theme(legend.position="none", axis.text.x = element_text(angle = 60, hjust = 1),panel.background = element_rect(fill="white")) #+ scale_x_continuous(breaks=year2$year)

p2

# Geomap

n <- joinCountryData2Map(ec2, joinCode="NAME", nameJoinColumn="Imcountry")
## 29 codes from your data successfully matched countries in the map
## 55 codes from your data failed to match with a country code in the map
## 214 codes from the map weren't represented in your data
mapCountryData(n, nameColumnToPlot="add", mapTitle="Top WildLife Import Country World Map" , colourPalette = "rainbow")

3.4 Combined Import and Export

Now we take the countries in both Top Export and Top Import Countries.Then we add the amount of Export and Import quanity to be the total amount. From the graph, we can see China has the largest amount among the world. The main trading area is in Asia.

# change name



names(ec20)[names(ec20)=="count"]<- "count1"

names(ec20)[names(ec20)=="add"]<- "add1"

names(ec20)[names(ec20)=="Imcountry"]<- "c"

names(ic20)[names(ic20)=="Excountry"]<- "c"



comb1<-  merge(ec20, ic20, by="c")

comb2<- comb1 %>% mutate( t= add1+add)



#barchart

p3 <- ggplot(comb2, aes(x=reorder(c,t),y=t))+

  geom_bar(aes(y=t,fill=t), stat="identity")+scale_fill_gradient(low="#9999FF", high="violetred3")+

  labs(x="Country", y="Count", title="Top WildLife Import & Export Country")+ theme_minimal()+
  theme(legend.position="none", axis.text.x = element_text(angle = 60, hjust = 1)) #+ scale_x_continuous(breaks=year2$year)

p3

# Geomap

n2 <- joinCountryData2Map(comb2, joinCode="NAME", nameJoinColumn="c")
## 5 codes from your data successfully matched countries in the map
## 1 codes from your data failed to match with a country code in the map
## 238 codes from the map weren't represented in your data
mapCountryData(n2, nameColumnToPlot="t", mapTitle="Top WildLife Import & Export Country World Map" , colourPalette = "rainbow")

4 🐗 Visualiztion for WildLife Trading

4.1 Taxonomic rank

In the biological classification, taxonomic rank is the relative level of a group of organisms(a taxon) in a taxonomic hiearchy. Examples of taxonomic ranks are species, genus, family, order, class, phylum, kingdom,domain, etc -[wkipedia]

Special thanks to Lexi.x for sharing the biology knowledge

We will plot by the taxonomic ranks

Starbucks?

The top class are:

  • Reptilia: turtles,snakes, lizards, and relatives

  • Mammalia:The Class Mammalia includes about 5000 species placed in 26 orders

  • Anthozoa: Includes corals, anemones, sea pens and seafans.

  • Aves: It has about 9,000 species. Aves are adapted to fly. All the birds come in the class Aves. They show courtship, parental care, nest building, and territorial behaviour.

    • Funny Bird names:

      1.Go-Away-Bird

      2.Little Bustard

      3.Noisy friarbird

      4.Sad flycatcher

      5.Boobies

  • Actinopteri: The ray-finned fishes (actinopterygians) are the largest group of living fishes and compose half of the living vertebrates. There are around 42 orders, 431 families and nearly 24,000 species. Almost all fish that you see belong to this class of fish. The most notable exceptions include lampreys, hagfish, lungfish, and coelocanths.

  • Amphibia: are ectothermic, tetrapod vertebrates of the class Amphibia. All living amphibians belong to the group Lissamphibia.

4.2 WildLife Animal Trading Bar Plot by Class

# with entries

cla1 <- filter(wild,!is.na(Class) &  Class !="")


cla1$sum <- rowSums(cla1[, c("exquantity", "imquantity")], na.rm=TRUE)


# group by purpose

cla1p <- group_by(cla1, Class )

cla2p <- dplyr::summarise(cla1p, sum1=sum(sum), count=n())
cla2a <- cla2p[(cla2p$count>1000),]
cla2b <- cla2p[(cla2p$count<1001),]

#barchart

atry3<- readPNG("/Users/fangya/HU/3.Kaggle/trade2016/t1.png", native=TRUE)
p41 <- ggplot(cla2a, aes(x=reorder(Class,count),y=count))+annotation_raster(atry3, xmin=0.5,xmax=4, ymin=10005, ymax=Inf) +
geom_bar(aes(y=count,fill=Class), stat="identity")+       scale_fill_brewer(palette="Set3")+
labs(x="Class", y="count",title="WildLife Trading by Class Top 5")+ theme(legend.position="none", axis.text.x = element_text(angle = 90, hjust = 1) ,panel.background = element_rect(fill="white"))+ylim(0,20000)
  


atry4<- readPNG("/Users/fangya/HU/3.Kaggle/trade2016/frog.png", native=TRUE)
p42 <- ggplot(cla2b, aes(x=reorder(Class,count),y=count))+
  annotation_raster(atry4, xmin=0.5,xmax=5, ymin=100, ymax=Inf)+
geom_bar(aes(y=count,fill=Class), stat="identity")+       scale_fill_brewer(palette="Set3")+
labs(x="Class", y="count",title="WildLife Trading by Class Top 6-16")+ 
  theme(legend.position="none", axis.text.x = element_text(angle = 90, hjust = 1), panel.background = element_rect(fill="white"))+ ylim(0,450)
  

p41

p42

4.3 WildLife Animal Trading Tree Map by Order

The Orchidales may be divided into the following families:

  • Burmanniaceae

  • Thismiaceae

  • Corsiaceae

  • Orchidaceae – the orchids 1. Apostasioideae - Apostasia and Neuwiedia 2. Cypripedoideae - lady’s slippers (4 genera) 3. Orchidoideae - most orchids (750 genera)

# with Order entries

t11 <- filter(wild,!is.na(Order) & Order!=" ")

# group by Term
t1p1 <- group_by(t11, Order )
t2p1 <- dplyr::summarise(t1p1,  count=n())
t2p1 <- filter(t2p1, count>100)

# Term treemap

treemap(t2p1, index="Order", vSize="count", type="index", 
 palette="Pastel2", title="WildLife Trade Order Treemap", fontsize.title=12, fontsize.labels = 200)

4.4 WildLife Animal Trading Family

# with Family entries

fa1 <- filter(wild,!is.na(Family))


# group by Family

f1p <- group_by(fa1, Family)

f2p <- dplyr::summarise(f1p, a=sum(allq),  count=n())

f2p1 <- filter(f2p, count!=461)



test <- arrange(f2p1, desc(a))

test1 <- test[1:24,]

atry6<- readPNG("/Users/fangya/HU/3.Kaggle/trade2016/e1.png", native=TRUE)
fp1t <- ggplot(test1, aes(x=reorder(Family,a),y=a))+annotation_raster(atry6, xmin=0.5,xmax=Inf, ymin=0, ymax=Inf) +
  geom_bar(aes(y=a,fill=a), stat="identity")+scale_fill_gradient(low="#a9bb9f", high="#3f3a6d")+
  labs(x="Family", y="Count",title="WildLife Traded Family Top 24")+ theme(legend.position="none", axis.text.x = element_text(angle = 60, hjust = 1),panel.background = element_rect(fill="white"))

fp1t

#fp1 <- ggplot(f2p1, aes(x=reorder(Family,count),y=count))+

 # geom_bar(aes(y=count,fill=count), stat="identity")+scale_fill_gradient(low="orange", high="red")+

  #labs(x="Family", y="Count",

   #    title="WildLife Traded Family Top 24")+ theme(legend.position="none", axis.text.x = element_text(angle = 60, hjust = 1))

#fp1

4.5 The Top Protected WildLife Trading by Genus

pro <- filter(wild, App. %in% c("I") )
pro <- filter(pro,!is.na(Genus) & Genus!=" ")

mf1p1 <- group_by(pro, Genus)
mf2p1 <- dplyr::summarise(mf1p1,  a1=sum(allq),count=n())
mf2p2=mf2p1[!mf2p1$count==384, ]
mf2p3=mf2p2[mf2p2$count >160, ]

atry5<- readPNG("/Users/fangya/HU/3.Kaggle/trade2016/f1.png", native=TRUE)
p43 <- ggplot(mf2p3, aes(x=reorder(Genus,count),y=count))+
  annotation_raster(atry5, xmin=0.5,xmax=5, ymin=50, ymax=Inf)+
geom_bar(aes(y=count,fill=Genus), stat="identity")+       scale_fill_brewer(palette="Set3")+
labs(x="Genus", y="count",title="WildLife Trading by Genus Top 10")+ 
  theme(legend.position="none", axis.text.x = element_text(angle = 90, hjust = 1), panel.background = element_rect(fill="white"))+ ylim(0,750)

p43  

4.6 WildLife Animal Trading Tree Map by Term

From the Treemap of WildLife trading terms, we selected the terms shows up more than 300 times in order get a general idea of what term human consumes the most. From the treemap can see more than half of the animal traded alive. Then followed by small leather products, which could be our leather bags or gentlemens belt. In addition, although Ivory Carving shows up a small square, it can only come from the elephants where other products can be obtained from different animals.

Extract Bear Bile Alive

# with purpose entries

t1 <- filter(wild,!is.na(Term))



# group by Term

t1p <- group_by(t1, Term )

t2p <- dplyr::summarise(t1p,  count=n())

t2p <- filter(t2p, count>300)



# Term treemap

treemap(t2p, index="Term", vSize="count", type="index", 

        palette="Pastel2", title="WildLife Trade Term Treemap", fontsize.title=12)

5 🌷 Analysis on Top 5 Most traded Families

mfa1 <- filter(wild, Family %in% c("Orchidaceae", "Anguillidae", "Zygophyllaceae", "Araliaceae", "Leguminosae") )



# group by Family, ppose

mf1p <- group_by(mfa1, Family, ppose)

mf2p <- dplyr::summarise(mf1p,  a1=sum(allq),count=n())

mf2p1 <- filter(mf2p, count>20)



# circle plot

# Set a number of 'empty bar'

mdata1 <- mf2p1

mdata1$id=seq(1, nrow(mdata1))

mlabel_data1=mdata1

mnumber_of_bar1=nrow(mlabel_data1)

angle1m= 90 - 360 * (mlabel_data1$id-0.5) /mnumber_of_bar1 

mlabel_data1$hjust<-ifelse( angle1m < -90, 1, 0)

mlabel_data1$angle<-ifelse(angle1m < -90, angle1m+180, angle1m)



mp <- ggplot(mdata1, aes(x=as.factor(id), y=count, fill=Family))+geom_bar(stat="identity", alpha=0.5) + ylim(-4500,8800)+theme_minimal()+theme(

    axis.text = element_blank(),

    panel.grid = element_blank(),

    plot.margin = unit(rep(-1,6), "cm")  ) +

  coord_polar()+

  geom_text(data=mlabel_data1, aes(x=id, y=count+10, label=ppose, hjust=hjust), color="black", fontface="bold",alpha=0.6, size=2.5, angle= mlabel_data1$angle, inherit.aes = FALSE ) + ggtitle("d") 

 

mp

6 🐘 Elephant Analysis

6.1 Elephant

Elephant is one of my favorite animals. However, they are facing great danger now. As the Elephant Export graph shows, Zimbabwe export 500,000 for hunting. and Angentina imports a lot of elephants for Hunting as Well. From the tree map we can see, the main reason for Elephant product is Tusks. I hope from this analysis I can always remind for myself when I in a shop again. NO TRADE, NO KILLING !!!

ephant <- filter(wild, Family %in% c("Elephantidae") )



# group by excountry, ppose

ephant1 <- group_by(ephant, ppose, Excountry)

ephant2 <- dplyr::summarise(ephant1, a2=sum(exquantity, na.rm=TRUE), count=n())

ephant3 <- filter(ephant2, a2>1000)



ep1 <- ggplot(ephant3, aes(x=reorder(Excountry,a2),y=a2))+

  geom_bar(aes(y=a2,fill=ppose ), stat="identity")+
 scale_fill_manual(values=c("#d0eaeb","#fdd7eb","#fce6c8","#a9bb9f","#706095"))+
  labs(x="Country", y="Export quantity",title="Elephant Export Purpose")+ 
  theme_minimal()+ theme( axis.text.x = element_text(angle = 60, hjust = 1))

ep1

# group by imcountry, ppose

ephant1i <- group_by(ephant, ppose, Imcountry)

ephant2i <- dplyr::summarise(ephant1i, a2=sum(imquantity, na.rm=TRUE), count=n())

ephant3i <- filter(ephant2i, a2>500)


ep1i <- ggplot(ephant3i, aes(x=reorder(Imcountry,a2),y=a2))+
  geom_bar(aes(y=a2,fill=ppose), stat="identity")+
  scale_fill_manual(values=c("#d0eaeb","#fdd7eb","#fce6c8","#a9bb9f","#706095"))+
  labs(x="Country", y="Import quantity",title="Elephant Import Purpose")+ 
  theme_minimal()+ theme( axis.text.x = element_text(angle = 60, hjust = 1))

ep1i

ephant11 <- group_by(ephant, Term, Excountry)

ephant21 <- dplyr::summarise(ephant11, a2=sum(allq), count=n())

treemap(ephant21, index="Term", vSize="a2", type="index", 

        palette="Greys", title="Elephant Trade Term Treemap", fontsize.title=12)

6.2 Elephant Confession

When I was really young, I got an ivory bracelet, I loved it so much that I have been wearing it ever since. I always feel it is my guardian. When I grow older, I m proud of my ivory jelwery, because it is unique. Until couple days ago, I read a news, a small elephant starved himself to death in Wild Animal Helping Center RUNGWA, Tanzania because he saw how human killed his mother to take the ivory. I was very shocked that Ivory can only be taken alive from the elephants and in order to take it, the hunters have to cut its face alive. I cant imagine how much pain the elephants have to take. It was then I felt so guilty I am one of the person why elephant is extincting, I could not undo what it is done. But I wont get any other piece of an ivory in my lifetime again.