mat <- matrix(c(0, 1, 0, 0, 0, 0, 1, 1, 0), nrow = 3, ncol = 3, byrow = T)
mat [,1] [,2] [,3]
[1,] 0 1 0
[2,] 0 0 0
[3,] 1 1 0
One basic format for network data is the matrix. You can make basic matrices using the matrix() function:
The rownames() and colnames() functions are used access or set the row names and column names.