Loading the data
## Here the data is being uploaded from a drop box folder
dat1<-read.csv(file="https://www.dropbox.com/s/mkz16rn4ggnnspp/PanTHERIA_1-0_WR05_Aug2008g.csv?dl=1",stringsAsFactors = FALSE,header = TRUE)
There are 4920 species of mammal in the world, but they are distributed unevenly within taxonomic groups:
# Creating a table of number of species in the mammal orders
knitr::kable(table(dat1$MSW05_Order),col.names=c("Order","No. of species"),caption = "Mammal Orders")
| Order | No. of species |
|---|---|
| Afrosoricida | 42 |
| Artiodactyla | 222 |
| Carnivora | 278 |
| Cetacea | 82 |
| Chiroptera | 1035 |
| Cingulata | 20 |
| Dasyuromorphia | 64 |
| Dermoptera | 2 |
| Didelphimorphia | 83 |
| Diprotodontia | 125 |
| Erinaceomorpha | 22 |
| Hyracoidea | 4 |
| Lagomorpha | 86 |
| Macroscelidea | 15 |
| Microbiotheria | 1 |
| Monotremata | 4 |
| Notoryctemorphia | 2 |
| Paucituberculata | 5 |
| Peramelemorphia | 18 |
| Perissodactyla | 16 |
| Pholidota | 8 |
| Pilosa | 9 |
| Primates | 333 |
| Proboscidea | 2 |
| Rodentia | 2047 |
| Scandentia | 20 |
| Sirenia | 4 |
| Soricomorpha | 370 |
| Tubulidentata | 1 |
Bats are the second largest mammal group. There are 1,035 species in this data set. Their mean geographic range size is 2,666,022 km2 (with standard deviation 4,330,378 km2). In the orders observed, the geographic range size varied for each species. Shows the number of species found in each geographical range category (0-100,000 km2, 100,000-1,000,000 km2 and larger than 1,000,000 km2).
## Question 1: First subset the "dat1" data frame for all bats.
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
bats <- dat1 %>% subset(MSW05_Order == "Chiroptera")
## There are 1035 bat species
## 2,666,022 km2
##4,330,378 km2
#I am subsetting the data in order to filter out the variables I need
bats_range_0_100000 <- bats %>% subset(Range_Area_km2 <= 100000)
No_bats_range_0_100000 <- length(unique(bats_range_0_100000$MSW05_Binomial))
bats_range_100000to1000000 <- bats %>% filter(between(Range_Area_km2, 100000, 1000000))
No_bats_range_100000to1000000 <- length(unique(bats_range_100000to1000000$MSW05_Binomial))
bats_range_more1000000 <- bats %>% subset(Range_Area_km2 >= 1000000)
No_bats_range_more1000000 <- length(unique(bats_range_more1000000$MSW05_Binomial))
#table of previously subsetted data
geo_range_size <- c("0-100,000", "100,000-1,000,000", "larger than 1,000,000")
No_of_bat_sp <- c(No_bats_range_0_100000, No_bats_range_100000to1000000, No_bats_range_more1000000)
bat_geo_range <- data.frame(geo_range_size, No_of_bat_sp)
knitr::kable(bat_geo_range, col.names = c("Geographical Range Size in km2","No. of species"), caption = "Number of species per geographical range size")
| Geographical Range Size in km2 | No. of species |
|---|---|
| 0-100,000 | 245 |
| 100,000-1,000,000 | 330 |
| larger than 1,000,000 | 436 |
The table shows that the number of bat species is variable between geographical range sizes. More species of bats have a larger geographical range size than a smaller one (>1000,000km^2 - 436 species, 0-100,000km^2 - 245 species).
**Mammals are incredibly diverse, this includes the size of mammals and their geographical ranges. The data shows that geographical range size is distributed between 0.000187km^2 and 63,034,304km^2 for the mammals studied.*
## Question 2: Produce a histogram of geographic range size across all mammals. You might need to transform the data for visualisation purposes.
#duplicating the data
dat_visual <- dat1
#creating a histogram with ggplot
options(scipen = 999)
ggplot2::ggplot() +
geom_histogram(data = dat_visual, aes(x = Range_Area_km2),
fill='#e84118', col="black") +
scale_x_continuous(trans = "log10", labels = scales::comma) +
ggtitle("Geographic range size across all mammals") +
labs(x = "Range size in km2", y = "Number of species")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 461 rows containing non-finite values (stat_bin).
# Isolating the Carnivora data in the histgram and plotting it in a different contasting colour.
dat_carnivore <- subset(dat1, dat1$MSW05_Order == "Carnivora")
options(scipen = 999)
ggplot2::ggplot() +
geom_histogram(data = dat_visual, aes(x = Range_Area_km2),
fill='#e84118', col="black") +
geom_histogram(data = dat_carnivore , aes(x = Range_Area_km2),
fill='#273c75', col="black") +
scale_x_continuous(trans = "log10", labels = scales::comma) +
ggtitle("Geographic range size across all mammals VS Carnivora") +
labs(x = "Range size in km2", y = "Number of species")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 461 rows containing non-finite values (stat_bin).
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 47 rows containing non-finite values (stat_bin).
# Inserting line which represent the median range of all the species in the data set and the median range of only Carnivora.
options(scipen = 999)
median_all = median(dat_visual$Range_Area_km2, na.rm=T)
median_carnivore = median(dat_carnivore$Range_Area_km2, na.rm=T)
ggplot2::ggplot() +
geom_histogram(data = dat_visual, aes(x = Range_Area_km2),
fill='#e84118', col="black") +
geom_histogram(data = dat_carnivore , aes(x = Range_Area_km2),
fill='#273c75', col="black") +
geom_vline(xintercept = median_all, col='#273c75') +
geom_vline(xintercept = median_carnivore, col='black') +
scale_x_continuous(trans = "log10", labels = scales::comma) +
ggtitle("Median of Geographic range size across all mammals VS Carnivora") +
labs(x = "Range size in km2", y = "Number of species")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 461 rows containing non-finite values (stat_bin).
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 47 rows containing non-finite values (stat_bin).
The histogram produces shows that the geographic range size for mammals skews towards larger areas (all mammals shown in red, only carnivora shown in blue). The median geographic range size is ~26,000km^2 for mammals whilst it is 2,810,000km^2 for carnivora. This shows that a higher percentage of carnivores use a larger geographical range size than mammals as a whole.
The relationship between georaphical range and the body size of carnivora species will be investigated below.
## Question 3: For one taxonomic group of mammals plot body size against geographic range size such that geographic range size is on the y-axis.
ggplot2::ggplot(data = dat_carnivore,
aes(x = AdultBodyMass_g,
y = Range_Area_km2)) +
geom_point() +
geom_smooth(method = lm) +
scale_x_continuous(trans = "log10", labels = scales::comma) +
scale_y_continuous(trans = "log10", labels = scales::comma) +
ggtitle("Adult Body Size VS Geographic range size of Carnivora") +
labs(x = "Adult Body Size in gram", y = "Range size in km2")
# Comparing the range to body size ratios for three other groups (Rodentia, Chiroptera, and Primates).
dat_rodentia <- subset(dat1, dat1$MSW05_Order == "Rodentia")
Rodentia_Plot <- ggplot2::ggplot(data = dat_rodentia,
aes(x = AdultBodyMass_g,
y = Range_Area_km2)) +
geom_point() +
geom_smooth(method = lm) +
scale_x_continuous(trans = "log10", labels = scales::comma) +
scale_y_continuous(trans = "log10", labels = scales::comma) +
ggtitle("Adult Body Size VS Geographic range size of Rodentia") +
labs(x = "Adult Body Size in gram", y = "Range size in km2")
dat_carnivora <- subset(dat1, dat1$MSW05_Order == "Carnivora")
Carnivora_Plot <- ggplot2::ggplot(data = dat_carnivore,
aes(x = AdultBodyMass_g,
y = Range_Area_km2)) +
geom_point() +
geom_smooth(method = lm) +
scale_x_continuous(trans = "log10", labels = scales::comma) +
scale_y_continuous(trans = "log10", labels = scales::comma) +
ggtitle("Adult Body Size VS Geographic range size of Carnivora") +
labs(x = "Adult Body Size in gram", y = "Range size in km2")
dat_chiroptera <- subset(dat1, dat1$MSW05_Order == "Chiroptera")
Chiroptera_Plot <- ggplot2::ggplot(data = dat_chiroptera,
aes(x = AdultBodyMass_g,
y = Range_Area_km2)) +
geom_point() +
geom_smooth(method = lm) +
scale_x_continuous(trans = "log10", labels = scales::comma) +
scale_y_continuous(trans = "log10", labels = scales::comma) +
ggtitle("Adult Body Size VS Geographic range size of Chiroptera") +
labs(x = "Adult Body Size in gram", y = "Range size in km2")
dat_Primates <- subset(dat1, dat1$MSW05_Order == "Primates")
Primates_Plot <- ggplot2::ggplot(data = dat_Primates,
aes(x = AdultBodyMass_g,
y = Range_Area_km2)) +
geom_point() +
geom_smooth(method = lm) +
scale_x_continuous(trans = "log10", labels = scales::comma) +
scale_y_continuous(trans = "log10", labels = scales::comma) +
ggtitle("Adult Body Size VS Geographic range size of Primates") +
labs(x = "Adult Body Size in gram", y = "Range size in km2")
Carnivora_Plot
Rodentia_Plot
Chiroptera_Plot
Primates_Plot
In carnivora the geographival range size and body size show a positive correlation with larger animals having larger geographical range sizes than smaller ones. For the other groups the data shows the same trend, except for in chiroptera where the inverse is displayed. A larger body size means they have a smaller geographical range area.
**Mammals bear live young in varying litter sizes. The size of a mammals litter could effect the need for a specific geographic range. I hypothesise that the larger the size of the litter the larger the geographic range due to the need to provide resources for an increased number of individuals.*
## Question 3: Create and state one other hypothesis about mammal life-history relationships and show some visualisations and an accompanying, brief analysis to investigate it whether it might be worth investigating further.
#Creating a Carnivora litter compared with range area plot
Carnivora__litter <- ggplot2::ggplot(data = dat_carnivore,
aes(x = Range_Area_km2,
y = LitterSize)) +
geom_point() +
geom_smooth(method = lm) +
scale_x_continuous(trans = "log10", labels = scales::comma) +
scale_y_continuous(trans = "log10", labels = scales::comma) +
ggtitle("Litter Size VS Geographic range size of Carnivora") +
labs(x = "Range size in km2", y = "Litter Size in gram")
#Rodentia litter plot
Rodentia__litter <- ggplot2::ggplot(data = dat_rodentia,
aes(x = Range_Area_km2,
y = LitterSize)) +
geom_point() +
geom_smooth(method = lm) +
scale_x_continuous(trans = "log10", labels = scales::comma) +
scale_y_continuous(trans = "log10", labels = scales::comma) +
ggtitle("Litter Size VS Geographic range size of Rodentia") +
labs(x = "Range size in km2", y = "Litter Size in gram")
#Chiroptera litter plot
Chiroptera__litter <- ggplot2::ggplot(data = dat_chiroptera,
aes(x = Range_Area_km2,
y = LitterSize)) +
geom_point() +
geom_smooth(method = lm) +
scale_x_continuous(trans = "log10", labels = scales::comma) +
scale_y_continuous(trans = "log10", labels = scales::comma) +
ggtitle("Litter Size VS Geographic range size of Chiroptera") +
labs(x = "Range size in km2", y = "Litter Size in gram")
#primates litter plot
Primates__litter <- ggplot2::ggplot(data = dat_Primates,
aes(x = Range_Area_km2,
y = LitterSize)) +
geom_point() +
geom_smooth(method = lm) +
scale_x_continuous(trans = "log10", labels = scales::comma) +
scale_y_continuous(trans = "log10", labels = scales::comma) +
ggtitle("Litter Size VS Geographic range size of Primates") +
labs(x = "Range size in km2", y = "Litter Size in gram")
print(Carnivora__litter)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 108 rows containing non-finite values (stat_smooth).
## Warning: Removed 108 rows containing missing values (geom_point).
print(Rodentia__litter)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1213 rows containing non-finite values (stat_smooth).
## Warning: Removed 1213 rows containing missing values (geom_point).
print(Chiroptera__litter)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 578 rows containing non-finite values (stat_smooth).
## Warning: Removed 578 rows containing missing values (geom_point).
print(Primates__litter)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 135 rows containing non-finite values (stat_smooth).
## Warning: Removed 135 rows containing missing values (geom_point).
From these graphs we can see that in 3/4 groups (rodentia, chiroptera, and carnivora) the geographical range does increase with the litter size (positive relationship). Primates showed the opposite trend with the litter size decreasng and geographical range increased. There is not enough evidence to reject the null hypothesis that the geographical range area will increase in acordance with litter size.