Binary.matrix.by.thresh-methods {NetPreProc} | R Documentation |
Transforming a real-valued network matrix into a binary matrix
Description
Methods to transform a a real-valued network matrix into a binary matrix. The binary matrix is obtained by thresholding: values above the given threshold are set to 1, otherwise to 0
Usage
Binary.matrix.by.thresh(W, thresh=0.5)
Arguments
W |
an object representing the graph to be normalized |
thresh |
the threshold (def.=0.5) |
Value
The normalized binary adjacency matrix of the network
Methods
signature(W = "graph")
-
an object of the virtual class graph (hence including objects of class
graphAM
andgraphNEL
from the package graph) signature(W = "matrix")
-
a matrix representing the adjacency matrix of the graph
Examples
library(bionetdata);
data(DD.chem.data);
W <- Binary.matrix.by.thresh(DD.chem.data);
# Using both methods with both signatures "matrix" and "graph"
# reducing dimension of the graph
library(graph);
DD.chem.data.red <- DD.chem.data[1:100,1:100];
W.red <- Binary.matrix.by.thresh(DD.chem.data.red);
g <- new("graphAM", adjMat=DD.chem.data.red, values=list(weight=DD.chem.data.red));
Wg <- Binary.matrix.by.thresh(g);
any(W.red!=Wg);
[Package NetPreProc version 1.2 Index]