
incidentally
What is an incidence matrix?
An incidence matrix is a way to mathematically represent a bipartite network or hypergraph. In a bipartite network, "agents" are connected to "artifacts", while in a hypergraph "agents" are connected by "artifacts." For example, if the agents are people and the artifacts are papers, then an incidence matrix representing a bipartite network or hypergraph might record which people wrote which papers. This type of data is common in many fields, including ecology where it records which species live in which locations, and social sciences where it records individuals' affiliations with clubs and organizations.
The R incidentally package

The incidentally package for R makes it easy to generate incidence matrices (a) that have specific characteristics, (b) from an existing social network, or (c) that represent legislators sponsoring bills in the US Congress. The package is freely available from CRAN and can be installed by typing install.packages("incidentally") into the R command line. Once the package is installed, load it by typing library(incidentally) and view the documentation by typing ?incidentally or vignette("incientally"). You can find a short walk-thru here. If you find a bug or want to request a few feature, please let us know via GitHub. For help using the package, don't hesitate to contact me. If you have used incidentally in a publication or pre-print, let me know and we'll send you a cool backbone hex decal!
Using incidentally to study the US Congress
The incidentally package offers several different functions for working with incidence matrices and bipartite networks. However, the incidence.from.congress() function is designed to facilitate research on legislative behavior in the US Congress. This function automatically builds custom datasets that record which legislators sponsored which bills. It provides access to sponsorship data in both the US House of Representatives and US Senate, from 2003 to present, for any type of legislation (bills and resolutions) on any policy area (32 topics). You can find a short walk-thru here, and a detailed tutorial here. Using the backbone package to analyze data generated by this function makes it possible to construct detailed custom political networks, like this one depicting the 108th session of the US House of Representatives.

Papers about incidentally
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
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