library(renv)
renv::load()
library(targets)
library(here)
tar_config_set(
store = here::here("_targets")
)
library(dplyr)
library(bipartite)Explore data of Coux et al. 2016
Let’s begin by looking at the data.
Overview of the data
First, we have the interaction networks.
data <- tar_read(data_coux)
head(data$interaction) site pollinator plant links
1 blabrolee A_mellifera Alcea_sp 2
2 blabrolee E_tenax Alcea_sp 0
3 blabrolee I_promissorius Alcea_sp 0
4 blabrolee L_sordidum Alcea_sp 0
5 blabrolee N_producta Alcea_sp 0
6 blabrolee P_pseudorudis Alcea_sp 0
We have plant traits.
str(data$plant_trait)'data.frame': 14 obs. of 16 variables:
$ plant : chr "Lolium_sp" "Daucus_carota" "Chenopodium_album" "Cordyline_sp" ...
$ growth_form : chr "grass" "herb" "herb" "tree" ...
$ annual_perennial : chr "annual" "biennial" "annual" "perennial" ...
$ single_inflo : int 2 2 2 2 1 2 2 1 2 2 ...
$ type_inflorescence : int 1 1 1 1 0 1 3 0 2 1 ...
$ pollnec_access : int 1 1 1 1 2 2 1 1 2 1 ...
$ flowers_per_inflorescence : int 2 3 2 3 1 1 2 1 2 1 ...
$ flower_symmetry : chr "zygomorphic" "actinomorphic" "actinomorphic" "actinomorphic" ...
$ inflorescence_symmetry : chr "zygomorphic" "actinomorphic" "actinomorphic" "actinomorphic" ...
$ spring : int 1 0 0 0 0 0 1 0 0 0 ...
$ summer : int 1 1 1 1 1 1 0 1 1 1 ...
$ fall : int 0 1 1 0 1 0 0 0 0 1 ...
$ winter : int 0 0 0 0 0 0 1 0 0 0 ...
$ flower_sex : chr "bisexual" "bisexual" "bisexual" "bisexual" ...
$ floral_fragrance : int 1 1 NA 3 2 1 1 1 1 3 ...
$ amount_of_nectar_per_poll_unit_per_day: int 1 3 1 2 3 3 1 2 2 2 ...
We have pollinator traits.
str(data$pollinator_trait)'data.frame': 16 obs. of 16 variables:
$ pollinator : chr "A_mellifera" "B_terrestris" "C_stygia" "C_vicina" ...
$ body_length : num 12 14.3 10.9 9 3.9 14.3 8.6 13 5.5 9.7 ...
$ body_weigth : num 4.5 6.8 5.7 4.9 1.6 5.1 3.2 2 1.7 2.2 ...
$ flw_vis_time : num 4.1 3.68 NA 10.1 NA ...
$ pref_nec : num 100 100 NA 100 NA 75 0 NA 100 14.3 ...
$ pref_pol : num 0 0 NA NA NA 25 100 NA 0 85.7 ...
$ soc_sol : chr "social" "social" "solitary" "solitary" ...
$ larv_necpol : int 1 1 0 0 0 0 0 0 1 0 ...
$ larv_plant : int 0 0 1 1 1 1 1 0 0 0 ...
$ larv_carr : int 0 0 1 1 0 0 0 0 0 0 ...
$ larv_paras : int 0 0 0 0 0 0 0 1 0 0 ...
$ larv_dung : int 0 0 0 0 0 0 0 0 0 0 ...
$ larv_dinsct : int 0 0 0 0 0 0 0 0 0 1 ...
$ Carrying_structure: chr "corbicula" "corbicula" "None" "None" ...
$ season : chr "Aug" "Jan" "Jun" "Jan" ...
$ daily : chr "X2pm" "X12pm" "X12pm" "X10am" ...
As well as, plant abundances, which is only presence (1) absence (0).
str(data$plant_abundance)'data.frame': 21 obs. of 15 variables:
$ site : chr "blabrolee" "blahamlak" "blaheslee" "blajergre" ...
$ Lolium_sp : int 1 1 1 1 1 1 1 1 1 1 ...
$ Daucus_carota : int 1 0 1 0 0 1 0 0 0 0 ...
$ Chenopodium_album : int 0 1 1 1 0 0 1 0 0 0 ...
$ Cordyline_sp : int 0 0 1 0 1 0 1 0 0 0 ...
$ Alcea_sp : int 1 0 1 0 0 1 0 1 0 0 ...
$ Rubus_fruticosus : int 1 1 0 0 0 0 1 0 1 0 ...
$ alnus_serrulate : int 0 1 0 0 0 0 1 0 0 0 ...
$ Malva_spp : int 0 1 1 0 0 0 0 0 0 0 ...
$ Taraxacum_officinale: int 1 1 1 0 1 1 1 1 1 1 ...
$ Raphanus_sp : int 0 1 1 0 0 0 1 1 0 1 ...
$ Cirsium_vulgare : int 1 1 1 0 1 1 1 1 1 1 ...
$ Eucalyptus_globulus : int 1 1 1 0 0 0 1 0 1 1 ...
$ Eucalyptus_nitens : int 1 1 1 1 1 0 1 0 0 1 ...
$ Trifolium_sp : int 1 1 1 0 1 1 1 0 1 1 ...
And pollinator abundances.
str(data$pollinator_abundance)'data.frame': 21 obs. of 17 variables:
$ site : chr "blabrolee" "blahamlak" "blaheslee" "blajergre" ...
$ A_mellifera : int 248 115 522 53 10 90 335 21 0 39 ...
$ B_terrestris : int 0 0 49 18 0 0 36 0 23 0 ...
$ C_stygia : int 0 0 0 0 0 0 0 0 0 0 ...
$ C_vicina : int 0 0 0 0 0 0 0 0 0 0 ...
$ D_platura : int 0 21 52 0 0 0 114 0 0 0 ...
$ E_tenax : int 5 0 5 0 0 0 0 0 0 0 ...
$ H_hochstetteri : int 0 7 0 0 0 0 0 0 0 0 ...
$ I_promissorius : int 2 0 2 0 0 0 0 0 0 0 ...
$ L_sordidum : int 3625 0 808 0 0 522 380 202 0 156 ...
$ M_novae_zelandiae: int 0 0 0 0 8 0 7 0 0 0 ...
$ N_producta : int 7 0 5 0 0 0 0 0 0 0 ...
$ O_atrovirens : int 0 27 0 0 2 4 0 0 0 0 ...
$ O_varia : int 0 10 6 0 0 0 0 0 2 0 ...
$ P_marginata : int 0 0 1 7 0 0 1 0 0 0 ...
$ P_pseudorudis : int 30 60 59 0 0 0 0 0 0 0 ...
$ T_orthodoxus : int 0 1 1 0 0 0 0 0 0 0 ...
We have coded a function to compute species level network metrics using the bipartite::specieslevel function.
net_metrics <- tar_read(net_metrics)
net_metrics# A tibble: 232 × 22
site degree normalised.degree species.strength interaction.push.pull
<chr> <dbl> <dbl> <dbl> <dbl>
1 blabrolee 7 0.778 5.36 0.623
2 blabrolee 1 0.111 1 0
3 blabrolee 3 0.333 0.435 -0.188
4 blabrolee 2 0.222 0.354 -0.323
5 blabrolee 4 0.444 1.50 0.124
6 blabrolee 3 0.333 0.354 -0.215
7 blabrolee 1 0.167 0.0690 -0.931
8 blabrolee 3 0.5 0.672 -0.109
9 blabrolee 1 0.167 0.167 -0.833
10 blabrolee 1 0.167 0.0690 -0.931
# ℹ 222 more rows
# ℹ 17 more variables: nestedrank <dbl>, PDI <dbl>, resource.range <dbl>,
# species.specificity.index <dbl>, PSI <dbl>,
# node.specialisation.index.NSI <dbl>, betweenness <dbl>,
# weighted.betweenness <dbl>, closeness <dbl>, weighted.closeness <dbl>,
# Fisher.alpha <dbl>, partner.diversity <dbl>, effective.partners <dbl>,
# proportional.generality <dbl>, proportional.similarity <dbl>, d <dbl>, …