get_incidence_matrix: Generate an incidence matrix from a interaction table

View source: R/get_incidence_matrix.R

get_incidence_matrixR Documentation

Generate an incidence matrix from a interaction table

Description

This function creates an incidence matrix

Usage

get_incidence_matrix(db, returnDataFrame = FALSE)

Arguments

db

A data.frame or matrix with two columns, for example host and parasites

returnDataFrame

Logical, by default if FALSE and the function returns a Matrix

Value

An incidence matrix or data.frame (tibble) with rows of one kind (for example host) and columns with the other (for example parasites) filled with ones and zeros.

Examples

get_incidence_matrix(beetleTreeInteractions)
get_incidence_matrix(beetleTreeInteractions,
returnDataFrame = TRUE)

alrobles/geotax documentation built on July 27, 2023, 4:37 a.m.