An open API service indexing awesome lists of open source software.

https://github.com/pakillo/network.tools

Tools to work with bipartite networks
https://github.com/pakillo/network.tools

Last synced: 3 months ago
JSON representation

Tools to work with bipartite networks

Awesome Lists containing this project

README

          

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "60%"
)
```

# network.tools

[![R-CMD-check](https://github.com/Pakillo/network.tools/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/Pakillo/network.tools/actions/workflows/R-CMD-check.yaml)
[![HitCount](https://hits.dwyl.com/Pakillo/network.tools.svg?style=flat-square)](http://hits.dwyl.com/Pakillo/network.tools)
[![HitCount](https://hits.dwyl.com/Pakillo/network.tools.svg?style=flat-square&show=unique)](http://hits.dwyl.com/Pakillo/network.tools)

Tools to work with bipartite networks.

## Installation

You can install the development version of network.tools from [GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
devtools::install_github("Pakillo/network.tools")
```

## Usage

```{r }
library(network.tools)
```

### Network visualisation

#### Visualise bipartite network as heatmap

```{r }
data(web)
plot_web_heatmap(web)
```

Binarize the network (make it qualitative):

```{r}
plot_web_heatmap(web, binarize = TRUE)
```

The output is a ggplot object that can be further modified:

```{r}
plot_web_heatmap(web) +
ggplot2::labs(title = "A bipartite network")
```

### Data management

#### Transform interaction data from long to wide format

```{r}
head(web)
long2wide(web)
```

#### Transform interaction data from wide to long format

```{r}
mat <- long2wide(web)
wide2long(mat)
```

### Individual specialisation indices

Calculate indices of niche width and individual specialisation following [Bolnick et al. 2002](https://doi.org/10.1890/0012-9658(2002)083[2936:MILRS]2.0.CO;2).

```{r}
data(web)
net <- long2wide(web)
net
indiv_spec(net)
```

See the package [website](https://pakillo.github.io/network.tools) for more information.

## Citation

```{r warning=FALSE, comment=NA}
citation("network.tools")
```