gravatar for ks.sholohova

2 hours ago by

Hello everyone!

I was trying to build a microbiome network in R using the example from the book. However, I got this error while converting a qraph network to igraph network. Here is the code for it.

  #get the data amgut1.filt, it could be derived from github. Besides, load some useful libraries.

library(devtools)
library(igraph)
library(qgraph)
devtools::install_github("zdk123/SpiecEasi")

data("amgut1.filt")

Now we have a file.

ebic.cor <- cor_auto(amgut1.filt)
#cor_auto suppose to count correlations.

#we try to find a graph with the best EBIC
ebic.graph <- EBICglasso(ebic.cor, ncol(amgut1.filt), 0.5)

#then build a qgraph network
ebic.qgnet <- qgraph(ebic.graph, DoNotPlot = TRUE)

#but we need an igraph network,so ...
ebic.net <- as.igraph(ebic.qgnet, attributes = TRUE)

After running the last line, I had this error.

In vattrs[[name]][index] <- value : number of items to replace is not
a multiple of replacement length

Does anyone had the same error? If so, I would highly appreciate the help with resolving this question.

Thanks in advance,
Kseniia



Source link