as_network: Convert ICON objects to network objects

Description Usage Arguments Value Examples

View source: R/converters.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' function converts 'ICON' objects to 'network' objects. It allows 'ICON' users to take full advantage of the functionality provided in the 'network' package.

Usage

1
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)

rrrlw/ICON documentation built on May 16, 2021, 8:40 a.m.