SachaEpskamp / qgraph

Developmental version of qgraph
GNU General Public License v2.0
68 stars 21 forks source link

centralityPlot error #29

Closed IrinaVanzhula closed 5 years ago

IrinaVanzhula commented 5 years ago

Hi Sasha,

I am getting an error running centralityPlot function:

Error in centralityTable(..., standardized = standardized, labels = labels, : (list) object cannot be coerced to type 'double'

My code is below. I know there was a previous issue on this error closed on March 6th. I re-downloaded qgraph through R and also tried downloading github version. I am still getting the error. This same exact code worked for me a few months ago. Thanks for your help!

Data1 <- as.data.frame(read_excel("C:/...) beepvar <- "beep" dayvar <- "day" Data1$time <- as.POSIXct(Data1$time) Data1$Day <- as.Date(Data1$time) data2 <-graphicalVAR(Data1, vars=Vars, beepvar=beepvar, gamma=0) u1 <- plot(data2, "PCC", labels = names) u2 <- plot(data2, "PDC", labels = names) c1 <- centralityPlot(u1) c2 <- centralityPlot(u2)

SachaEpskamp commented 5 years ago

This has been fixed, but I think the code you use here should not work for graphicalVAR. This should work:

data2 <-graphicalVAR(Data1, vars=Vars, beepvar=beepvar, gamma=0)
c1 <- centralityPlot(data2 $PCC)
c2 <- centralityPlot(data2 $PDC)