How to save a adjacency matrix with "get.adjacency()" in R, with iGraph and RStudio?

adjacency-matrix, igraph, r, rstudio

Solution

Try using `sparse=FALSE` in the call to `get.adjacency(...)`

g <- graph.full(5)
test <- get.adjacency(g)
class(test)
# [1] "dgCMatrix"
# attr(,"package")
# [1] "Matrix"

test <- get.adjacency(g,sparse=FALSE)
class(test)
# [1] "matrix"

Problem

is it possible to save an adjacency matrix after "get.adjacency()" as an adjacency matrix in R? I tried ``` test <- get.adjacency(network) ``` but I´m getting the error ``` Error in View : cannot coerce class "structure("dgCMatrix", package = "Matrix")" to a data.frame. ``` I´m using RStudio and the package iGraph.

Original source