Given a function matrix created by foodweb_matrix(), convert it into a text specification that can be passed to DiagrammeR::grViz().

graphviz_spec_from_matrix(funmat)

Arguments

funmat

A function matrix generated by foodweb_matrix().

Value

A text string.

See also

Examples


fm <- matrix(c(0, 1, 1, 1, 0, 1, 0, 1, 0), nrow = 3)
colnames(fm) <- rownames(fm) <- c("foo", "bar", "baz")
graphviz_spec_from_matrix(fm)
#> digraph 'foodweb' {
#>   "foo()" -> { "bar()" }
#>   "bar()" -> { "foo()", "baz()" }
#>   "baz()" -> { "foo()", "bar()" }
#> }