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

Description Usage Arguments Value Examples

View source: R/s3.R

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

1
2
## S3 method for class '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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## 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

## End(Not run)

ICON documentation built on Oct. 24, 2020, 1:06 a.m.