`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_network` function converts `ICON` objects to `network` objects. It allows `ICON` users to take full advantage of the functionality provided in the `network` package.
as_network(x, directed = FALSE, return_relabeled = FALSE)
x | edgelist of classes `ICON` and `data.frame` to be coerced |
---|---|
directed | `TRUE` if network has directed edges; `FALSE` otherwise |
return_relabeled | nodes are likely to be relabeled to fit naming conventions of the `network` package; if the names are important, setting `return_relabeled` to `TRUE` returns the resulting `network` object and a relabeling key-pair vector |
if `return_relabeled` is `FALSE`, a `network` object; if `return_relabeled` is `TRUE`, a `list` containing the `network` object and the relabeling key-pair vector
if (FALSE) { # download dataset using ICON get_data("aishihik_intensity") # don't care about relabeled vertices converted <- as_network(aishihik_intensity, directed = TRUE) # we care about relabeled vertices converted2 <- as_network(aishihik_intensity, directed = TRUE, return_relabeled = TRUE) # get the network converted_network <- converted2$network # get the relabeling key-pair vector converted_relabel <- converted2$labels }