knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
Morphological indices can be helpful to depict ecological differences between feeding guilds and between species differing in their preferred foraging stratum.
There are 6 morphological indices, which are often calculated:
Here, we show how to calculate these indices, using the data included in this package:
#' First we load our Data library(traitdata) data(passerines) #' Secondly, we need to load the dplyr library library(dplyr) #' Now, we can calculate the indices using the mutate function from the dplyr package passerines <- passerines %>% mutate(tail_wing_index = Tail / Wing, bill_height_index = `Bill D` / `Bill L`, bill_width_index = `Bill W` / `Bill L`) #kipp_index = kipp / Wing, #lateral_tarsus_index = lateral.tarsus.diameter / tarsus.length #sagittal_tarsus_index = sagittal.tarsus.diamter / tarsus.length
Now, we want to plot these indices:
#' Load the ggplot2 library library(ggplot2); library(patchwork) #' Plot a histogram of the 3 indices p1 <- passerines %>% ggplot() + geom_histogram(aes(x=tail_wing_index)) + scale_y_continuous(expand=expansion(add=c(0,10))) + labs(x="Tail wing index", y="Frequency") + theme_bw() p2 <- passerines %>% ggplot() + geom_histogram(aes(x=bill_height_index)) + scale_y_continuous(expand=expansion(add=c(0,10))) + labs(x="Bill height index", y="") + theme_bw() p3 <- passerines %>% ggplot() + geom_histogram(aes(x=bill_width_index)) + scale_y_continuous(expand=expansion(add=c(0,10))) + labs(x="Bill width index", y="") + theme_bw() p1 + p2 + p3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.