Description Usage Arguments Value Examples
View source: R/01_project_to_one_mode.R
Create a one-mode projection of a two mode graph. Converts a rectangular matrix to a square one by taking the cross product of the input matrix. The edge weights in the resulting matrix are equal to the number of transitive ties of each node in the input matrix.
1 | project_to_one_mode(adj_mat, mode = c("rows", "columns"))
|
adj_mat |
Sparse matrix of class dgCMatrix |
mode |
Mode to return. Defaults to projecting by rows. |
A double or complex matrix, with appropriate dimnames taken from x and y.
1 2 3 4 5 6 | #make matrix
my_matrix <- sparseMatrix(i = c(1, 1, 2, 3, 4, 4, 5, 6, 7, 7),
j = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), x = 1
)
#project to one mode
project_to_one_mode(adj_mat = my_matrix, mode = "rows")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.