#Loading Packages
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.2 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.2 ✔ tibble 3.2.1
## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
## ✔ purrr 1.0.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(lme4)
## Loading required package: Matrix
##
## Attaching package: 'Matrix'
##
## The following objects are masked from 'package:tidyr':
##
## expand, pack, unpack
library(lmerTest)
##
## Attaching package: 'lmerTest'
##
## The following object is masked from 'package:lme4':
##
## lmer
##
## The following object is masked from 'package:stats':
##
## step
library(emmeans)
library(ggpubr)
library(viridis)
## Loading required package: viridisLite
library(bipartite)
## Loading required package: vegan
## Loading required package: permute
## Loading required package: lattice
## This is vegan 2.6-4
## Loading required package: sna
## Loading required package: statnet.common
##
## Attaching package: 'statnet.common'
##
## The following objects are masked from 'package:base':
##
## attr, order
##
## Loading required package: network
##
## 'network' 1.18.1 (2023-01-24), part of the Statnet Project
## * 'news(package="network")' for changes since last version
## * 'citation("network")' for citation information
## * 'https://statnet.org' for help, support, and other information
##
## sna: Tools for Social Network Analysis
## Version 2.7-1 created on 2023-01-24.
## copyright (c) 2005, Carter T. Butts, University of California-Irvine
## For citation information, type citation("sna").
## Type help(package="sna") to get started.
##
## This is bipartite 2.18.
## For latest changes see versionlog in ?"bipartite-package". For citation see: citation("bipartite").
## Have a nice time plotting and analysing two-mode networks.
##
## Attaching package: 'bipartite'
##
## The following object is masked from 'package:vegan':
##
## nullmodel
library(ggbipart)
library(ggmosaic)
library(ggalluvial)
library(report)
#Reading in the Data
flow.data <- read.csv("Centropogan Data - Flower.csv", header = TRUE, na.strings = c(""," ","NA")) #Load in the data
str(flow.data) #Look at the structure of the data
## 'data.frame': 95 obs. of 7 variables:
## $ color : chr "pink" "pink" "pink" "pink" ...
## $ f.species: chr "C. talamancensis" "C. talamancensis" "C. talamancensis" "C. talamancensis" ...
## $ plant_id : int 1 1 1 1 1 1 2 2 2 2 ...
## $ sex : chr "F" "M" "M" "F" ...
## $ corolla : num 43.2 45.6 43.8 45.6 45 ...
## $ anther : num 66.2 63.6 63.1 67.6 64.6 ...
## $ camera : chr NA NA NA NA ...
cam.data <- read.csv("Centropogan Data - Camera.csv", header = TRUE, na.strings = c(""," ","NA"))
str(cam.data)
## 'data.frame': 58 obs. of 6 variables:
## $ camera : chr "1" "2" "2" "4" ...
## $ date : chr "6-30-2023" "07-02-2023" "07-01-2023" "07-01-2023" ...
## $ time : chr "12:33" "5:30" "16:53" "8:15" ...
## $ b.species: chr "Panterpe insignis" NA "Colibri cyanotus" "Eugenes spectabilis" ...
## $ f.species: chr "C. costaricae" "C. valerii" "C. valerii" "C. talamancensis" ...
## $ notes : chr NA "Unidentified" "Cato MFDC 1636" NA ...
bird.data <-read.csv("Centropogan Data - Bird.csv", header = TRUE, na.strings = c(""," ","NA"))
## Warning in read.table(file = file, header = header, sep = sep, quote = quote, :
## incomplete final line found by readTableHeader on 'Centropogan Data - Bird.csv'
str(bird.data)
## 'data.frame': 3 obs. of 13 variables:
## $ b.species : chr "Panterpe insignis" "Colibri cyanotus" "Eugenes spectabilis"
## $ fem_length : num 19.5 22.6 36.3
## $ male_length: num 19.3 23.6 31
## $ avg_length : num 19.4 23.1 33.6
## $ low_length : num 17.8 20.2 29
## $ high_length: num 21.8 25.5 37.5
## $ min_corolla: num 25.6 24.2 42
## $ max_corolla: num 31.1 29.8 52.6
## $ avg_corolla: num 28.7 27.9 46
## $ min_anther : num 33.1 36.5 54.7
## $ max_anther : num 41.2 48.9 75.2
## $ avg_anther : num 37.7 44.5 66
## $ reference : chr "https://birdsoftheworld.org/bow/species/fithum1/cur/appendices" "https://birdsoftheworld.org/bow/species/lesvio1/cur/appearance#meas" "https://birdsoftheworld.org/bow/species/maghum2/cur/appearance#meas"
range.data <-read.csv("Centropogan Data - Rangeplot.csv", header = TRUE, na.strings = c(""," ","NA"))
str(range.data)
## 'data.frame': 6 obs. of 4 variables:
## $ species : chr "Panterpe insignis" "Colibri cyanotus" "Eugenes spectabilis" "C. costaricae" ...
## $ min_length: num 17.8 20.2 29 33.1 36.5 ...
## $ max_length: num 21.8 25.5 37.5 41.2 48.9 ...
## $ avg_length: num 19.8 22.9 33.2 37.7 44.5 ...
#changing plant id to factor
flow.data$f.plant_id <- as.factor(flow.data$plant_id)
#Exploring the Flower Data
species <- unique(flow.data$f.species)
#Histograms of Corolla length by species
for (i in species) {
x <- flow.data$corolla[flow.data$f.species== i]
hist(x,
xlab = paste("Corolla Length",i))
}
#Histograms of Anther length by species
for (i in species) {
x <- flow.data$anther[flow.data$f.species== i]
hist(x,
xlab = paste("Anther Length",i))
}
#Shapiro-Wilk Test of normality of Corolla length by species
for (i in species) {
x <- flow.data$corolla[flow.data$f.species== i]
print(shapiro.test(x))
}
##
## Shapiro-Wilk normality test
##
## data: x
## W = 0.94262, p-value = 0.107
##
##
## Shapiro-Wilk normality test
##
## data: x
## W = 0.93599, p-value = 0.04687
##
##
## Shapiro-Wilk normality test
##
## data: x
## W = 0.98252, p-value = 0.8784
#Shapiro-Wilk Test of normality of Anther length by species
for (i in species) {
x <- flow.data$anther[flow.data$f.species== i]
print(shapiro.test(x))
}
##
## Shapiro-Wilk normality test
##
## data: x
## W = 0.94096, p-value = 0.09651
##
##
## Shapiro-Wilk normality test
##
## data: x
## W = 0.94588, p-value = 0.09241
##
##
## Shapiro-Wilk normality test
##
## data: x
## W = 0.97751, p-value = 0.7403
## All look approximately normally distributed.
Are there differences in corolla length by species and sex?
#Re-ording flowers
flow.data$f.species <- factor(flow.data$f.species, levels=c('C. talamancensis', 'C. valerii', 'C. costaricae'))
#Calculating exsertion length
flow.data$exsertion <- flow.data$anther-flow.data$corolla
mod.1 <-lmer(corolla ~ f.species + (1|f.plant_id), data = flow.data)
summary(mod.1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: corolla ~ f.species + (1 | f.plant_id)
## Data: flow.data
##
## REML criterion at convergence: 361.7
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.7515 -0.5521 0.0413 0.5235 3.7635
##
## Random effects:
## Groups Name Variance Std.Dev.
## f.plant_id (Intercept) 0.7943 0.8912
## Residual 2.2753 1.5084
## Number of obs: 95, groups: f.plant_id, 21
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 45.9730 0.4845 13.6703 94.90 < 2e-16 ***
## f.speciesC. valerii -18.1489 0.6595 13.9313 -27.52 1.52e-13 ***
## f.speciesC. costaricae -17.6803 0.6661 17.8346 -26.54 8.72e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) f.sC.v
## f.spcsC.vlr -0.735
## f.spcsC.cst -0.727 0.534
emmeans(mod.1, list(pairwise ~ f.species), adjust = "tukey")
## $`emmeans of f.species`
## f.species emmean SE df lower.CL upper.CL
## C. talamancensis 46.0 0.484 12.0 44.9 47.0
## C. valerii 27.8 0.448 12.6 26.9 28.8
## C. costaricae 28.3 0.470 22.3 27.3 29.3
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $`pairwise differences of f.species`
## 1 estimate SE df t.ratio p.value
## C. talamancensis - C. valerii 18.149 0.660 12.3 27.514 <.0001
## C. talamancensis - C. costaricae 17.680 0.675 15.8 26.201 <.0001
## C. valerii - C. costaricae -0.469 0.649 16.6 -0.722 0.7540
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 3 estimates
report(mod.1)
## We fitted a linear mixed model (estimated using REML and nloptwrap optimizer)
## to predict corolla with f.species (formula: corolla ~ f.species). The model
## included f.plant_id as random effect (formula: ~1 | f.plant_id). The model's
## total explanatory power is substantial (conditional R2 = 0.97) and the part
## related to the fixed effects alone (marginal R2) is of 0.96. The model's
## intercept, corresponding to f.species = C. talamancensis, is at 45.97 (95% CI
## [45.01, 46.94], t(90) = 94.90, p < .001). Within this model:
##
## - The effect of f species [C. valerii] is statistically significant and
## negative (beta = -18.15, 95% CI [-19.46, -16.84], t(90) = -27.52, p < .001;
## Std. beta = -2.15, 95% CI [-2.30, -1.99])
## - The effect of f species [C. costaricae] is statistically significant and
## negative (beta = -17.68, 95% CI [-19.00, -16.36], t(90) = -26.54, p < .001;
## Std. beta = -2.09, 95% CI [-2.25, -1.93])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald t-distribution approximation.
Are there differences in anther length by species and sex?
mod.2 <-lmer(anther ~ f.species + (1|f.plant_id), data = flow.data)
summary(mod.2)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: anther ~ f.species + (1 | f.plant_id)
## Data: flow.data
##
## REML criterion at convergence: 454.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.4630 -0.4778 0.0338 0.5860 3.4551
##
## Random effects:
## Groups Name Variance Std.Dev.
## f.plant_id (Intercept) 1.841 1.357
## Residual 6.372 2.524
## Number of obs: 95, groups: f.plant_id, 21
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 65.959 0.762 12.209 86.56 < 2e-16 ***
## f.speciesC. valerii -21.503 1.038 12.469 -20.72 4.92e-11 ***
## f.speciesC. costaricae -28.323 1.056 15.851 -26.83 1.23e-14 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) f.sC.v
## f.spcsC.vlr -0.734
## f.spcsC.cst -0.722 0.530
emmeans(mod.2, list(pairwise ~ f.species), adjust = "tukey")
## $`emmeans of f.species`
## f.species emmean SE df lower.CL upper.CL
## C. talamancensis 66.0 0.762 11.9 64.3 67.6
## C. valerii 44.5 0.705 12.4 42.9 46.0
## C. costaricae 37.6 0.754 21.3 36.1 39.2
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $`pairwise differences of f.species`
## 1 estimate SE df t.ratio p.value
## C. talamancensis - C. valerii 21.50 1.04 12.2 20.712 <.0001
## C. talamancensis - C. costaricae 28.32 1.07 15.5 26.416 <.0001
## C. valerii - C. costaricae 6.82 1.03 16.2 6.605 <.0001
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 3 estimates
report(mod.2)
## We fitted a linear mixed model (estimated using REML and nloptwrap optimizer)
## to predict anther with f.species (formula: anther ~ f.species). The model
## included f.plant_id as random effect (formula: ~1 | f.plant_id). The model's
## total explanatory power is substantial (conditional R2 = 0.96) and the part
## related to the fixed effects alone (marginal R2) is of 0.95. The model's
## intercept, corresponding to f.species = C. talamancensis, is at 65.96 (95% CI
## [64.44, 67.47], t(90) = 86.56, p < .001). Within this model:
##
## - The effect of f species [C. valerii] is statistically significant and
## negative (beta = -21.50, 95% CI [-23.57, -19.44], t(90) = -20.72, p < .001;
## Std. beta = -1.76, 95% CI [-1.93, -1.59])
## - The effect of f species [C. costaricae] is statistically significant and
## negative (beta = -28.32, 95% CI [-30.42, -26.23], t(90) = -26.83, p < .001;
## Std. beta = -2.32, 95% CI [-2.49, -2.15])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald t-distribution approximation.
Are there differences in anther length by species and sex?
mod.3 <-lmer(exsertion ~ f.species + (1|f.plant_id), data = flow.data)
summary(mod.3)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: exsertion ~ f.species + (1 | f.plant_id)
## Data: flow.data
##
## REML criterion at convergence: 456.2
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.6630 -0.4115 0.1488 0.5401 2.7307
##
## Random effects:
## Groups Name Variance Std.Dev.
## f.plant_id (Intercept) 0.5785 0.7606
## Residual 7.0504 2.6553
## Number of obs: 95, groups: f.plant_id, 21
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 19.9857 0.5922 14.6339 33.747 2.73e-15 ***
## f.speciesC. valerii -3.3377 0.8098 15.0775 -4.122 0.000896 ***
## f.speciesC. costaricae -10.8330 0.8423 15.3374 -12.862 1.27e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) f.sC.v
## f.spcsC.vlr -0.731
## f.spcsC.cst -0.703 0.514
emmeans(mod.3, list(pairwise ~ f.species), adjust = "tukey")
## $`emmeans of f.species`
## f.species emmean SE df lower.CL upper.CL
## C. talamancensis 19.99 0.592 11.7 18.69 21.3
## C. valerii 16.65 0.553 12.5 15.45 17.8
## C. costaricae 9.15 0.639 12.8 7.77 10.5
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
##
## $`pairwise differences of f.species`
## 1 estimate SE df t.ratio p.value
## C. talamancensis - C. valerii 3.34 0.810 12.0 4.119 0.0037
## C. talamancensis - C. costaricae 10.83 0.871 12.2 12.431 <.0001
## C. valerii - C. costaricae 7.50 0.845 12.7 8.866 <.0001
##
## Degrees-of-freedom method: kenward-roger
## P value adjustment: tukey method for comparing a family of 3 estimates
report(mod.3)
## We fitted a linear mixed model (estimated using REML and nloptwrap optimizer)
## to predict exsertion with f.species (formula: exsertion ~ f.species). The model
## included f.plant_id as random effect (formula: ~1 | f.plant_id). The model's
## total explanatory power is substantial (conditional R2 = 0.75) and the part
## related to the fixed effects alone (marginal R2) is of 0.73. The model's
## intercept, corresponding to f.species = C. talamancensis, is at 19.99 (95% CI
## [18.81, 21.16], t(90) = 33.75, p < .001). Within this model:
##
## - The effect of f species [C. valerii] is statistically significant and
## negative (beta = -3.34, 95% CI [-4.95, -1.73], t(90) = -4.12, p < .001; Std.
## beta = -0.63, 95% CI [-0.93, -0.33])
## - The effect of f species [C. costaricae] is statistically significant and
## negative (beta = -10.83, 95% CI [-12.51, -9.16], t(90) = -12.86, p < .001; Std.
## beta = -2.04, 95% CI [-2.35, -1.72])
##
## Standardized parameters were obtained by fitting the model on a standardized
## version of the dataset. 95% Confidence Intervals (CIs) and p-values were
## computed using a Wald t-distribution approximation.
flow.data.agg.1 <- aggregate(anther ~ f.species, data = flow.data, FUN = mean)
flow.data.agg <- flow.data %>%
group_by(f.species) %>%
summarise(corolla=mean(corolla))%>%
left_join(flow.data.agg.1, by = c("f.species"))
#Looking at mean anther and corolla length for each plant species
#Calculating exsertion length
flow.data.agg$exsertion <- flow.data.agg$anther-flow.data.agg$corolla
flow.data.agg
## # A tibble: 3 × 4
## f.species corolla anther exsertion
## <fct> <dbl> <dbl> <dbl>
## 1 C. talamancensis 46.0 66.0 20.0
## 2 C. valerii 27.9 44.5 16.7
## 3 C. costaricae 28.7 37.7 8.98
#Looking at how many measurements were taken for each plant species
flow.obs <- flow.data %>%
group_by(f.species) %>%
summarise(n.obs = n())
#Data Visualization ##Creating Theme for Plots
AsiaTheme <- theme(axis.text.x = element_text(size = 15, face = "italic"),
axis.text.y = element_text(size = 19),
axis.title.x = element_text(size = 16),
axis.title.y = element_text(size = 16),
legend.title = element_text(size = 15),
legend.text = element_text(size = 14))
##Plots
plot(corolla ~ anther, data = flow.data)
plot.1a <- ggplot(flow.data, aes(y = corolla, x= f.species, color = sex))+
geom_boxplot(lwd=1)+
geom_jitter(alpha=0.6, width=0.15)+
ylim(25,60)+
theme_classic2()+
AsiaTheme+
labs(x = "",
y = "Corolla length (mm)")+
scale_colour_viridis_d()
plot.1b <- ggplot(flow.data, aes(y = anther, x= f.species, color = sex))+
geom_boxplot(lwd=1)+
geom_jitter(alpha=0.6, width=0.15)+
ylim(30,80)+
theme_classic()+
AsiaTheme+
labs(x = "",
y = "Anther length (mm)")+
scale_colour_viridis_d()
plot.1 <-ggarrange(plot.1a,plot.1b)
## Warning: Removed 1 rows containing non-finite values (`stat_boxplot()`).
## Warning: Removed 1 rows containing missing values (`geom_point()`).
plot.1
ggsave("plot1.png", plot.1, width = 13, height = 5, units = "in")
#A dataframe with bird abundance by plant species
cam.data.1 <- cam.data %>%
filter(cam.data$b.species != "unknown" & !is.na(cam.data$b.species)) %>%
group_by(f.species, b.species) %>%
summarise(n.obs=n())
## `summarise()` has grouped output by 'f.species'. You can override using the
## `.groups` argument.
#Pivot dataframe wide to get into correct format
cam.data.wide <- as.data.frame(pivot_wider(cam.data.1, names_from = f.species, values_from = n.obs, values_fill = 0))
cam.data.wide <-cam.data.wide[,-1]
chisq <- chisq.test(cam.data.wide)
## Warning in chisq.test(cam.data.wide): Chi-squared approximation may be
## incorrect
chisq
##
## Pearson's Chi-squared test
##
## data: cam.data.wide
## X-squared = 97.164, df = 4, p-value < 2.2e-16
##Visualizing Results of Chi Square Test
cam.data.1$f.species <- factor(cam.data.1$f.species, levels=c('C. talamancensis', 'C. valerii', 'C. costaricae'))
species
## [1] "C. talamancensis" "C. valerii" "C. costaricae"
plot.2 <- ggplot(cam.data.1, aes(x = f.species, y = n.obs))+
geom_col(aes(fill = b.species), width = 0.7)+
theme_classic2()+
AsiaTheme+
labs(x = "Centropogan Species",
y = "Pollinator Visits",
color=NULL)+
theme(legend.position="top",
legend.title=element_blank(),
legend.text = element_text(size = 14, face = "italic"))+
scale_fill_viridis_d()
plot.2
ggsave("Figure 3.png", plot.2, width = 7, height = 5, units = "in")
#Minimum corolla for all species
for (i in species) {
print(min(flow.data$corolla[flow.data$f.species == i]))
}
## [1] 42
## [1] 24.2
## [1] 25.6
#Maximum corolla for all species
for (i in species) {
print(max(flow.data$corolla[flow.data$f.species == i]))
}
## [1] 52.6
## [1] 29.81
## [1] 31.11
#Minimum anther for all species
for (i in species) {
print(min(flow.data$anther[flow.data$f.species == i]))
}
## [1] 54.7
## [1] 36.52
## [1] 33.1
#Maximum anther for all species
for (i in species) {
print(max(flow.data$anther[flow.data$f.species == i]))
}
## [1] 75.18
## [1] 48.9
## [1] 41.2
range.data %>%
ggplot(aes(x = avg_length, color = species)) +
geom_linerange(aes(ymin = min_length, ymax = max_length, x = avg_length),
size = 1.5, alpha = 0.25) +
geom_point(aes(y = min_length), colour = "#CB5416") +
geom_point(aes(y = max_length), colour = "#267266") +
coord_flip() +
ylab("Length (mm)") +
theme_classic2() +
theme(axis.title.y = element_blank(),
axis.text.y = element_blank())
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
cor.test(bird.data$avg_length, bird.data$avg_corolla)
##
## Pearson's product-moment correlation
##
## data: bird.data$avg_length and bird.data$avg_corolla
## t = 3.3194, df = 1, p-value = 0.1863
## alternative hypothesis: true correlation is not equal to 0
## sample estimates:
## cor
## 0.9574943
cor.test(bird.data$avg_length, bird.data$avg_anther)
##
## Pearson's product-moment correlation
##
## data: bird.data$avg_length and bird.data$avg_anther
## t = 55.478, df = 1, p-value = 0.01147
## alternative hypothesis: true correlation is not equal to 0
## sample estimates:
## cor
## 0.9998376
bird.data
## b.species fem_length male_length avg_length low_length high_length
## 1 Panterpe insignis 19.5 19.3 19.40 17.8 21.8
## 2 Colibri cyanotus 22.6 23.6 23.10 20.2 25.5
## 3 Eugenes spectabilis 36.3 31.0 33.65 29.0 37.5
## min_corolla max_corolla avg_corolla min_anther max_anther avg_anther
## 1 25.6 31.11 28.67613 33.10 41.20 37.65903
## 2 24.2 29.81 27.86353 36.52 48.90 44.52882
## 3 42.0 52.60 45.97300 54.70 75.18 65.95867
## reference
## 1 https://birdsoftheworld.org/bow/species/fithum1/cur/appendices
## 2 https://birdsoftheworld.org/bow/species/lesvio1/cur/appearance#meas
## 3 https://birdsoftheworld.org/bow/species/maghum2/cur/appearance#meas
#Adding birds to dataset
flow.data$b.species[flow.data$f.species == "C. talamancensis"] <-"Eugenes spectabilis"
flow.data$b.species[flow.data$f.species == "C. valerii"] <-"Colibri cyanotus"
flow.data$b.species[flow.data$f.species == "C. costaricae"] <- "Panterpe insignis"
#Adding Bird beak length to dataset
flow.data$b.length[flow.data$b.species == "Eugenes spectabilis"] <-33.65
flow.data$b.length[flow.data$b.species == "Colibri cyanotus"] <-23.10
flow.data$b.length[flow.data$b.species == "Panterpe insignis"] <-19.40
flow.data
## color f.species plant_id sex corolla anther camera f.plant_id
## 1 pink C. talamancensis 1 F 43.20 66.20 <NA> 1
## 2 pink C. talamancensis 1 M 45.65 63.57 <NA> 1
## 3 pink C. talamancensis 1 M 43.80 63.10 <NA> 1
## 4 pink C. talamancensis 1 F 45.60 67.59 <NA> 1
## 5 pink C. talamancensis 1 F 45.00 64.60 <NA> 1
## 6 pink C. talamancensis 1 M 45.58 65.73 <NA> 1
## 7 orange C. valerii 2 M 27.38 42.68 2 2
## 8 orange C. valerii 2 F 25.50 41.70 2 2
## 9 orange C. valerii 2 F 24.20 43.50 2 2
## 10 orange C. valerii 2 M 29.61 40.64 2 2
## 11 pink C. talamancensis 3 M 44.90 54.70 6 3
## 12 pink C. talamancensis 3 M 52.60 67.57 6 3
## 13 pink C. talamancensis 3 F 48.50 68.60 6 3
## 14 pink C. talamancensis 3 M 45.23 67.69 6 3
## 15 pink C. talamancensis 3 F 48.40 71.20 6 3
## 16 pink C. talamancensis 3 F 44.63 66.06 6 3
## 17 orange C. valerii 4 F 27.68 46.71 7 4
## 18 orange C. valerii 4 F 26.20 44.60 7 4
## 19 orange C. valerii 4 F 25.46 46.68 7 4
## 20 orange C. valerii 4 M 26.75 44.20 7 4
## 21 orange C. valerii 4 M 27.02 43.80 7 4
## 22 orange C. valerii 4 M 27.13 44.79 7 4
## 23 pink C. talamancensis 5 M 44.90 67.90 <NA> 5
## 24 pink C. talamancensis 5 F 45.49 70.25 <NA> 5
## 25 pink C. talamancensis 5 M 48.75 62.47 <NA> 5
## 26 pink C. talamancensis 5 M 45.40 65.40 <NA> 5
## 27 pink C. talamancensis 5 F 48.75 70.43 <NA> 5
## 28 pink C. talamancensis 5 F 45.50 68.40 <NA> 5
## 29 pink C. talamancensis 6 M 47.01 61.72 <NA> 6
## 30 pink C. talamancensis 6 F 44.10 65.10 <NA> 6
## 31 pink C. talamancensis 6 M 44.15 63.80 <NA> 6
## 32 pink C. talamancensis 6 M 43.90 64.50 <NA> 6
## 33 pink C. talamancensis 6 F 46.44 67.30 <NA> 6
## 34 pink C. talamancensis 6 F 44.30 64.40 <NA> 6
## 35 red C. costaricae 7 F 28.13 38.23 <NA> 7
## 36 red C. costaricae 8 M 27.20 35.80 <NA> 8
## 37 orange C. valerii 9 M 29.10 43.80 <NA> 9
## 38 orange C. valerii 9 M 29.00 42.60 <NA> 9
## 39 orange C. valerii 9 M 28.30 43.30 <NA> 9
## 40 orange C. valerii 9 F 27.40 45.20 <NA> 9
## 41 orange C. valerii 9 M 28.20 42.80 <NA> 9
## 42 orange C. valerii 9 F 27.50 44.70 <NA> 9
## 43 orange C. valerii 10 M 29.20 47.10 <NA> 10
## 44 orange C. valerii 10 M 28.40 47.40 <NA> 10
## 45 orange C. valerii 10 F 27.40 45.60 <NA> 10
## 46 orange C. valerii 10 M 29.30 46.40 <NA> 10
## 47 orange C. valerii 10 F 29.50 48.10 <NA> 10
## 48 orange C. valerii 10 F 29.20 46.00 <NA> 10
## 49 orange C. valerii 11 M 29.60 46.60 <NA> 11
## 50 orange C. valerii 11 F 29.60 47.80 <NA> 11
## 51 orange C. valerii 11 M 29.34 48.90 <NA> 11
## 52 orange C. valerii 11 F 29.60 46.20 <NA> 11
## 53 orange C. valerii 11 F 28.51 48.11 <NA> 11
## 54 orange C. valerii 11 M 29.81 44.59 <NA> 11
## 55 pink C. talamancensis 12 F 47.77 75.18 <NA> 12
## 56 pink C. talamancensis 12 F 42.80 64.20 <NA> 12
## 57 pink C. talamancensis 12 M 48.60 64.90 <NA> 12
## 58 pink C. talamancensis 12 M 48.97 65.04 <NA> 12
## 59 pink C. talamancensis 12 M 42.00 62.80 <NA> 12
## 60 pink C. talamancensis 12 F 47.27 68.36 <NA> 12
## 61 red C. costaricae 13 F 25.60 33.10 <NA> 13
## 62 red C. costaricae 13 M 27.00 34.40 <NA> 13
## 63 red C. costaricae 14 M 30.15 34.36 <NA> 14
## 64 red C. costaricae 14 M 28.70 37.00 1 14
## 65 red C. costaricae 14 F 28.50 37.30 1 14
## 66 red C. costaricae 14 F 31.11 37.93 5 14
## 67 red C. costaricae 14 M 29.70 35.80 1 14
## 68 red C. costaricae 14 M 30.44 36.42 5 14
## 69 red C. costaricae 14 M 29.66 35.66 5 14
## 70 red C. costaricae 14 M 30.10 39.60 <NA> 14
## 71 red C. costaricae 14 M 30.49 37.42 <NA> 14
## 72 red C. costaricae 14 F 27.17 37.17 5 14
## 73 red C. costaricae 14 M 29.87 38.10 <NA> 14
## 74 red C. costaricae 14 F 29.58 39.70 <NA> 14
## 75 red C. costaricae 14 F 28.53 39.79 <NA> 14
## 76 orange C. valerii 15 M 25.62 43.49 <NA> 15
## 77 orange C. valerii 15 F 26.41 42.94 <NA> 15
## 78 orange C. valerii 15 F 27.43 44.49 <NA> 15
## 79 orange C. valerii 15 M 27.36 38.68 <NA> 15
## 80 orange C. valerii 15 F 26.97 43.36 <NA> 15
## 81 orange C. valerii 15 M 27.68 36.52 <NA> 15
## 82 red C. costaricae 16 F 28.10 38.00 <NA> 16
## 83 red C. costaricae 17 M 29.92 39.25 <NA> 17
## 84 red C. costaricae 18 F 28.10 41.20 <NA> 18
## 85 red C. costaricae 19 F 26.70 37.00 <NA> 19
## 86 red C. costaricae 20 M 27.70 38.00 C 20
## 87 red C. costaricae 20 M 27.50 37.40 C 20
## 88 red C. costaricae 20 M 28.20 39.40 C 20
## 89 red C. costaricae 20 M 29.40 39.10 C 20
## 90 red C. costaricae 20 F 29.10 40.20 C 20
## 91 red C. costaricae 20 M 28.30 37.70 C 20
## 92 red C. costaricae 20 F 29.40 40.10 C 20
## 93 red C. costaricae 20 M 27.50 37.00 C 20
## 94 red C. costaricae 20 M 28.21 36.60 C 20
## 95 red C. costaricae 21 F 28.90 38.70 <NA> 21
## exsertion b.species b.length
## 1 23.00 Eugenes spectabilis 33.65
## 2 17.92 Eugenes spectabilis 33.65
## 3 19.30 Eugenes spectabilis 33.65
## 4 21.99 Eugenes spectabilis 33.65
## 5 19.60 Eugenes spectabilis 33.65
## 6 20.15 Eugenes spectabilis 33.65
## 7 15.30 Colibri cyanotus 23.10
## 8 16.20 Colibri cyanotus 23.10
## 9 19.30 Colibri cyanotus 23.10
## 10 11.03 Colibri cyanotus 23.10
## 11 9.80 Eugenes spectabilis 33.65
## 12 14.97 Eugenes spectabilis 33.65
## 13 20.10 Eugenes spectabilis 33.65
## 14 22.46 Eugenes spectabilis 33.65
## 15 22.80 Eugenes spectabilis 33.65
## 16 21.43 Eugenes spectabilis 33.65
## 17 19.03 Colibri cyanotus 23.10
## 18 18.40 Colibri cyanotus 23.10
## 19 21.22 Colibri cyanotus 23.10
## 20 17.45 Colibri cyanotus 23.10
## 21 16.78 Colibri cyanotus 23.10
## 22 17.66 Colibri cyanotus 23.10
## 23 23.00 Eugenes spectabilis 33.65
## 24 24.76 Eugenes spectabilis 33.65
## 25 13.72 Eugenes spectabilis 33.65
## 26 20.00 Eugenes spectabilis 33.65
## 27 21.68 Eugenes spectabilis 33.65
## 28 22.90 Eugenes spectabilis 33.65
## 29 14.71 Eugenes spectabilis 33.65
## 30 21.00 Eugenes spectabilis 33.65
## 31 19.65 Eugenes spectabilis 33.65
## 32 20.60 Eugenes spectabilis 33.65
## 33 20.86 Eugenes spectabilis 33.65
## 34 20.10 Eugenes spectabilis 33.65
## 35 10.10 Panterpe insignis 19.40
## 36 8.60 Panterpe insignis 19.40
## 37 14.70 Colibri cyanotus 23.10
## 38 13.60 Colibri cyanotus 23.10
## 39 15.00 Colibri cyanotus 23.10
## 40 17.80 Colibri cyanotus 23.10
## 41 14.60 Colibri cyanotus 23.10
## 42 17.20 Colibri cyanotus 23.10
## 43 17.90 Colibri cyanotus 23.10
## 44 19.00 Colibri cyanotus 23.10
## 45 18.20 Colibri cyanotus 23.10
## 46 17.10 Colibri cyanotus 23.10
## 47 18.60 Colibri cyanotus 23.10
## 48 16.80 Colibri cyanotus 23.10
## 49 17.00 Colibri cyanotus 23.10
## 50 18.20 Colibri cyanotus 23.10
## 51 19.56 Colibri cyanotus 23.10
## 52 16.60 Colibri cyanotus 23.10
## 53 19.60 Colibri cyanotus 23.10
## 54 14.78 Colibri cyanotus 23.10
## 55 27.41 Eugenes spectabilis 33.65
## 56 21.40 Eugenes spectabilis 33.65
## 57 16.30 Eugenes spectabilis 33.65
## 58 16.07 Eugenes spectabilis 33.65
## 59 20.80 Eugenes spectabilis 33.65
## 60 21.09 Eugenes spectabilis 33.65
## 61 7.50 Panterpe insignis 19.40
## 62 7.40 Panterpe insignis 19.40
## 63 4.21 Panterpe insignis 19.40
## 64 8.30 Panterpe insignis 19.40
## 65 8.80 Panterpe insignis 19.40
## 66 6.82 Panterpe insignis 19.40
## 67 6.10 Panterpe insignis 19.40
## 68 5.98 Panterpe insignis 19.40
## 69 6.00 Panterpe insignis 19.40
## 70 9.50 Panterpe insignis 19.40
## 71 6.93 Panterpe insignis 19.40
## 72 10.00 Panterpe insignis 19.40
## 73 8.23 Panterpe insignis 19.40
## 74 10.12 Panterpe insignis 19.40
## 75 11.26 Panterpe insignis 19.40
## 76 17.87 Colibri cyanotus 23.10
## 77 16.53 Colibri cyanotus 23.10
## 78 17.06 Colibri cyanotus 23.10
## 79 11.32 Colibri cyanotus 23.10
## 80 16.39 Colibri cyanotus 23.10
## 81 8.84 Colibri cyanotus 23.10
## 82 9.90 Panterpe insignis 19.40
## 83 9.33 Panterpe insignis 19.40
## 84 13.10 Panterpe insignis 19.40
## 85 10.30 Panterpe insignis 19.40
## 86 10.30 Panterpe insignis 19.40
## 87 9.90 Panterpe insignis 19.40
## 88 11.20 Panterpe insignis 19.40
## 89 9.70 Panterpe insignis 19.40
## 90 11.10 Panterpe insignis 19.40
## 91 9.40 Panterpe insignis 19.40
## 92 10.70 Panterpe insignis 19.40
## 93 9.50 Panterpe insignis 19.40
## 94 8.39 Panterpe insignis 19.40
## 95 9.80 Panterpe insignis 19.40
cor.test(flow.data$b.length, flow.data$anther)
##
## Pearson's product-moment correlation
##
## data: flow.data$b.length and flow.data$anther
## t = 41.285, df = 93, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.9608124 0.9825035
## sample estimates:
## cor
## 0.9737865
Plot with anther length
plot.4 <-ggplot(flow.data, aes(x = b.length, y = anther))+
geom_point()+
theme_classic2()+
AsiaTheme+
labs(x = "Hummingbird bill length (mm)",
y = "Anther length (mm)",
color=NULL)+
theme(legend.position="top",
legend.title=element_blank(),
legend.text = element_text(size = 14, face = "italic"))
plot.4