Tools to work with bipartite networks.
You can install the development version of network.tools from GitHub with:
# install.packages("devtools")
devtools::install_github("Pakillo/network.tools")library(network.tools)data(web)
plot_web_heatmap(web)Binarize the network (make it qualitative):
plot_web_heatmap(web, binarize = TRUE)The output is a ggplot object that can be further modified:
plot_web_heatmap(web) +
ggplot2::labs(title = "A bipartite network")head(web)
#> Plant Animal Visits
#> 1 P1 A1 1
#> 2 P1 A2 0
#> 3 P1 A3 0
#> 4 P1 A4 0
#> 5 P1 A5 2
#> 6 P1 A6 0long2wide(web)
#> A6 A1 A3 A4 A5 A7 A8 A2
#> P3 5 3 3 2 1 1 1 1
#> P2 3 3 2 0 0 1 1 0
#> P4 1 1 1 2 1 1 0 2
#> P1 0 1 0 0 2 1 2 0mat <- long2wide(web)
wide2long(mat)
#> # A tibble: 32 × 3
#> Plant Animal Visits
#> <chr> <chr> <int>
#> 1 P3 A6 5
#> 2 P3 A1 3
#> 3 P3 A3 3
#> 4 P3 A4 2
#> 5 P3 A5 1
#> 6 P3 A7 1
#> 7 P3 A8 1
#> 8 P3 A2 1
#> 9 P2 A6 3
#> 10 P2 A1 3
#> # ℹ 22 more rowsCalculate indices of niche width and individual specialisation following Bolnick et al. 2002.
data(web)
net <- long2wide(web)
net
#> A6 A1 A3 A4 A5 A7 A8 A2
#> P3 5 3 3 2 1 1 1 1
#> P2 3 3 2 0 0 1 1 0
#> P4 1 1 1 2 1 1 0 2
#> P1 0 1 0 0 2 1 2 0indiv_spec(net)
#> WIC TNW IndSpec
#> 1 1.71828 2.008202 0.8556311See the package website for more information.
citation("network.tools")
To cite package 'network.tools' in publications use:
Rodriguez-Sanchez F (????). _network.tools: Tools to Analyse and
Visualise Bipartite Networks_. R package version 0.0.5,
https://pakillo.github.io/network.tools/,
<https://github.com/Pakillo/network.tools>.
A BibTeX entry for LaTeX users is
@Manual{,
title = {network.tools: Tools to Analyse and Visualise Bipartite Networks},
author = {Francisco Rodriguez-Sanchez},
note = {R package version 0.0.5, https://pakillo.github.io/network.tools/},
url = {https://github.com/Pakillo/network.tools},
}

