## ----setup, message=FALSE, warning=FALSE--------------------------------------

library(pfwim)
library(dplyr)
library(igraph)

data("traits", package = "pfwim")
data("feeding_rules", package = "pfwim")


## -----------------------------------------------------------------------------


metaweb_el <- infer_edgelist(
  data = traits,
  cat_combo_list = feeding_rules,
  col_taxon = "species",
  certainty_req = "all",
  hide_printout = TRUE
)

head(metaweb_el)


## -----------------------------------------------------------------------------


metaweb_graph <- graph_from_data_frame(
  metaweb_el,
  directed = TRUE
)

metaweb_graph


## -----------------------------------------------------------------------------


set.seed(66)

plot(
  metaweb_graph,
  vertex.size = 35,
  vertex.label.cex = 0.6,
  edge.arrow.size = 0.3,
  layout = layout_with_fr(metaweb_graph),
  main = "Metaweb"
)


