interaction_table_to_matrix: Convert an interaction table to a matrix

View source: R/metrics.R

interaction_table_to_matrixR Documentation

Convert an interaction table to a matrix

Description

Convert an interaction table to a matrix

Usage

interaction_table_to_matrix(data, row_col, column_col, value_col, fill = 0)

Arguments

data

Data frame.

row_col, column_col, value_col

Column names.

fill

Missing-pair value.

Value

A numeric matrix with row and column species names. Unspecified pairs receive fill; repeated pairs use the last supplied value.

Examples

records <- data.frame(plant = c("a", "b"), animal = c("x", "x"), p = c(0.8, 0.3))
interaction_table_to_matrix(records, "plant", "animal", "p")

metaweave documentation built on Nov. 3, 2026, 9:06 a.m.