Learn R Programming

incidentally

Welcome

Welcome to the incidentally package! The incidentally package implements methods to generate incidence matrices, which can represent bipartite (aka two-mode, affiliation) networks.

The incidentally package can be cited as:

Neal, Z. P. (2022). incidentally: An R package for generating incidence matrices and bipartite graphs. CRAN. https://doi.org/10.32614/CRAN.package.incidentally

Two extended functions in the incidentally package have their own citations, which provide extended tutorials. The incidence.from.congress() function can be cited as:

Neal, Z. P. (2022). Constructing legislative networks in R using incidentally and backbone. Connections, 42, 1-9. https://doi.org/10.2478/connections-2019.026

The incidence.from.adjacency() function can be cited as:

Neal, Z. P. (2023). The duality of networks and groups: Models to generate two-mode networks from one-mode networks. Network Science, 11, 397-410. https://doi.org/10.1017/nws.2023.3.

Installation

The /release branch contains the current CRAN release of the incidentally package. You can install it from CRAN with:

install.packages("incidentally")

The /devel branch contains the working beta version of the next release of the incidentally package. All the functions are documented and have undergone various levels of preliminary debugging, so they should mostly work, but there are no guarantees. Feel free to use the devel version (with caution), and let us know if you run into any problems. You can install it You can install from GitHub with:

library(devtools)
install_github("zpneal/incidentally", ref = "devel", build_vignettes = TRUE)

Dependencies

The incidentally package adopts the tinyverse philosophy, and therefore aims to keep dependencies at a minimum.

Copy Link

Version

Install

install.packages('incidentally')

Monthly Downloads

314

Version

1.0.3

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Zachary Neal

Last Published

July 28th, 2025

Functions in incidentally (1.0.3)

space

Examine the space of incidence matrices with fixed marginals
incidence.from.vector

Generates an incidence matrix with given row and column marginal sums
incidence.from.distribution

Generates an incidence matrix with row and column sums that follow given distributions
curveball

Randomize an incidence matrix or bipartite graph using the curveball algorithm
add.blocks

Adds a block structure to an incidence matrix
incidence.from.probability

Generates an incidence matrix with a given cell-filling probability
incidence.from.congress

Generate bill sponsorship incidence matrices and bipartite graphs
incidentally

incidentally: Generates incidence matrices and bipartite graphs
incidence.from.adjacency

Generates an incidence matrix from an adjacency matrix