Learn R Programming

icon (version 0.4.0)

as.network.ICON: Coerce ICON objects into network objects

Description

`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.ICON` method is an S3 generic for the `network::as.network` method and the `ICON` class. It allows `ICON` users to take full advantage of the functionality provided in the `network` package using `network` objects.

Usage

# S3 method for ICON
as.network(x, directed = FALSE, return_relabeled = FALSE)

Arguments

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

Value

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

Examples

Run this code
# NOT RUN {
# 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
# }

Run the code above in your browser using DataLab