Learn R Programming

NetworkToolbox (version 1.4.2)

un.direct: Convert Directed Network to Undirected Network

Description

Converts a directed network to an undirected network

Usage

un.direct(A, diagonal = 0)

Arguments

A

Matrix or data frame. Adjacency matrix (network matrix)

diagonal

Numeric. Number to be placed on the diagonal. Defaults to 0

Value

Returns a symmetric adjacency matrix

Examples

Run this code
# NOT RUN {
# Pearson's correlation only for CRAN checks
A <- TMFG(neoOpen, normal = FALSE)$A

# create a directed network
dir <- A * sample(c(0,1), size = length(A), replace = TRUE)

# undirect the directed network
undir <- un.direct(dir)

# }

Run the code above in your browser using DataLab