`ICON::get_data` returns data frames that also have class `ICON`. However, conducting network analysis could require using another R package and its associated network structure and class. The `as_igraph` function converts `ICON` objects to `igraph` objects. It allows `ICON` users to take full advantage of the functionality provided in the `igraph` package.
as_igraph(x, directed = FALSE, weighted = (ncol(x) > 2))
x | edgelist of classes `ICON` and `data.frame` to be coerced |
---|---|
directed | `TRUE` if network has directed edges; `FALSE` otherwise |
weighted | `TRUE` if network has weighted edges; `FALSE` otherwise |
an `igraph` object
Note that if the `ICON` object has more than two columns, `as_igraph` assumes that the third column is numeric and represents edge weights. Use `weighted = FALSE` to ignore existing edge weights and re-order columns if you would prefer another column be used for edge weights.