Learn R Programming

NetComp (version 1.6)

netIntersect: Network Intersection

Description

Returns the intersection of the input matrices. Output object is an adjacency matrix where the edge weight is the average value of the absolute value of edges in BOTH matrices. Edges not present in either, or below the cutoff are removed or set to zero.

Usage

netIntersect(matrix1, matrix2, cutoff=NULL, absolute=TRUE, ...)

Arguments

matrix1
Square matrix (e.g. correlation or adjacency) containing row/column labels
matrix2
Square matrix (e.g. correlation or adjacency) containing row/column labels
cutoff
The cutoff value. Edges less than this value (absolute value considered)are converted to zero.
absolute
Logical, should the absolute values be considered for the cutoff value.
...
Other parameters.

Value

netIntersect returns an adjacency matrix containing edged present in both graphs.

Details

Matrices must be square and have row and column labels. Output adjacency matrix can be used directly for creating a graph object.

Examples

Run this code
 #using the state.x77 and USArrests datasets
 arrestCor<-cor(t(USArrests))
 stateCor<-cor(t(state.x77))
 isect<-netIntersect(stateCor, arrestCor)
 isect[1:15,1:5]
 #Setting a cutoff to remove any edges that are below 0.6 
 isect.6<-netIntersect(stateCor, arrestCor, cutoff=0.6)
 isect.6[1:15,1:5]

Run the code above in your browser using DataLab