SachaEpskamp / qgraph

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

Flow function in qgraph error edgeConnectPoints #51

Closed lsnadeau closed 2 years ago

lsnadeau commented 3 years ago

Hello I'm new with R and start to learn network analysis using qgraph with a data cohort that have sf36 questionnaire. I try to do a flow diagram from one of the item and I get this error below. I don't find references about this error. I did a qgraph call g2 g2 <- qgraph(corMat_n, graph = "glasso", layout = L2, sampleSize = nrow(Datan), esize = 20, cut = 0.1, minimum = 0, maximum = 1, groups = groups1, color = c("red", "yellow", "orange", "cornflowerblue", "green", "purple", "grey", "maroon1", "chocolate3"), borders = FALSE, vsize= 10, labels = labels1, legend = FALSE) mtext("(b)", cex = 1.25, side = 1, line = 8.7, las = 1)

then run the flow and get an error

flow(g2, "SF 32", theme = "colorblind", vsize = 4) Error in qgraph(object, layout = Layout, curve = Curve, edgeConnectPoints = ECP, : Number of rows in 'edgeConnectPoints' do not match number of edges

I don't know where to look for that type of error. Am I giving enough information?

thank you Lyne

SachaEpskamp commented 3 years ago

Hi! Could you provide a reproducible example of the error?

lsnadeau commented 3 years ago

Thank you for your answer Mr Epskamp, I used data from our cohort , subjets who answered sf36 questionnaire, and try to replicate what you have done in the article Kossakowski and all (2016) “The application of a network approach to Health-Related Quality of Life (HRQoL): introducing a new method for assessing HRQoL in healthy adults and cancer patients”. I use the R progam associated to the article. I have to modify the program because when running the cor_auto function alone I get an error for the qgraph.

corMat_test <- cor_auto(Datan) … other lines for lables and groups

gcorMat_n <- qgraph(corMat_test, graph = "glasso", sampleSize = nrow(Datan), esize = 20, cut = 0.1, minimum = 0, maximum = 1, groups = groups1, color = c("red", "yellow", "orange", "cornflowerblue", "green", "purple", "grey", "maroon1", "chocolate3"), borders = FALSE, vsize= 10, labels = labels1, legend = FALSE)

I get this error

Error in EBICglassoCore(S = S, n = n, gamma = gamma, penalize.diagonal = penalize.diagonal, : 'S' is not positive definite

I don’t get this error if I take out the yes/no questions (questions 4a-d and 5a-c), but to replicate the analysis using all sf36 questions, I found the function forcePD So I change for

corMat_test <- cor_auto(Datan,forcePD =TRUE)

get this warning In cor_auto(Datan, forcePD = TRUE) : Correlation matrix is not positive definite. Finding nearest positive definite matrix

Then run gcorMat_test <- qgraph(corMat_test, graph = "glasso", sampleSize = nrow(Datan), esize = 20, cut = 0.1, minimum = 0, maximum = 1, groups = groups1, color = c("red", "yellow", "orange", "cornflowerblue", "green", "purple", "grey", "maroon1", "chocolate3"), borders = FALSE, vsize= 10, labels = labels1, legend = FALSE)

get this warning Warning message: In EBICglassoCore(S = S, n = n, gamma = gamma, penalize.diagonal = penalize.diagonal, : A dense regularized network was selected (lambda < 0.1 * lambda.max). Recent work indicates a possible drop in specificity. Interpret the presence of the smallest edges with care. Setting threshold = TRUE will enforce higher specificity, at the cost of sensitivity.

Then run the flow

flow(gcorMat_test, "02", vsize = 4)

and get this error Error in qgraph(object, layout = Layout, curve = Curve, edgeConnectPoints = ECP, : Number of rows in 'edgeConnectPoints' do not match number of edges

Should I send you dataset corMat_test?

Thanks a lot for your help Lyne


De : Sacha Epskamp notifications@github.com Envoyé : 17 février 2021 06:16 À : SachaEpskamp/qgraph qgraph@noreply.github.com Cc : Lyne Nadeau, Mlle lyne.nadeau@mcgill.ca; Author author@noreply.github.com Objet : Re: [SachaEpskamp/qgraph] Flow function in qgraph error edgeConnectPoints (#51)

Hi! Could you provide a reproducible example of the error?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/SachaEpskamp/qgraph/issues/51#issuecomment-780486653, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AS2P4GZ23BBGTKTCJSV3KYDS7OQRJANCNFSM4XQ36KAQ.

SachaEpskamp commented 3 years ago

I meant perhaps you can try to make a minimal reproducible example. See for some details here. For example, this code runs for me:

library("qgraph")

corMat_n <- matrix(0.1,6,6)
diag(corMat_n) <- 1

qgraph(corMat_n, graph = "glasso", sampleSize = 1000,
       esize = 20, cut = 0.1,
       minimum = 0, maximum = 1,  
       borders = FALSE, vsize= 10,  legend = FALSE)

If you can extend that code to the point where it reproduces your error we can figure out the problem.

lsnadeau commented 3 years ago

I was not sure how to do it with my dataset. I use the one available on line - bfi - data and replicated the example from https://www.rdocumentation.org/packages/qgraph/versions/1.6.9/topics/flow I get the same error message as with my dataset.

Let me know if this is not a good way of doing it, I will try to make my own dataset as minimal reproducible example.

This is the information on my Rstudio version (from console)

R version 4.0.3 Patched (2020-11-24 r79490) -- "Bunny-Wunnies Freak Out" Copyright (C) 2020 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit)

with those notes Registered S3 methods overwritten by 'BDgraph': method from plot.sim huge print.sim huge


Program I run library("qgraph") library("psych")

bdata<-read.csv("bfi.csv")

bdata2 <- bdata[,2:26] # Select only variables

bcorMat <- cor_auto(bdata2) # Correlate data

Glasso network:

g2 <- qgraph(bcorMat, cut = 0, graph = "glasso", sampleSize = nrow(bdata2), threshold = TRUE)

Flow from A2:

flow(g2, "A2", horizontal = TRUE)

}


information on the console

library("qgraph") library("psych")

bdata<-read.csv("bfi.csv") bdata2 <- bdata[,2:26] # Select only variables bcorMat <- cor_auto(bdata2) # Correlate data Variables detected as ordinal: A1; A2; A3; A4; A5; C1; C2; C3; C4; C5; E1; E2; E3; E4; E5; N1; N2; N3; N4; N5; O1; O2; O3; O4; O5

Glasso network:

g2 <- qgraph(bcorMat, cut = 0, graph = "glasso", sampleSize = nrow(bdata2),

  • threshold = TRUE)

    Flow from A2:

    flow(g2, "A2", horizontal = TRUE) Error in qgraph(object, layout = Layout, curve = Curve, edgeConnectPoints = ECP, : Number of rows in 'edgeConnectPoints' do not match number of edges

    }

thank you Lyne


De : Sacha Epskamp notifications@github.com Envoyé : 22 février 2021 05:19 À : SachaEpskamp/qgraph qgraph@noreply.github.com Cc : Lyne Nadeau, Mlle lyne.nadeau@mcgill.ca; Author author@noreply.github.com Objet : Re: [SachaEpskamp/qgraph] Flow function in qgraph error edgeConnectPoints (#51)

I meant perhaps you can try to make a minimal reproducible example. See for some details herehttps://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example. For example, this code runs for me:

library("qgraph")

corMat_n <- matrix(0.1,6,6) diag(corMat_n) <- 1

qgraph(corMat_n, graph = "glasso", sampleSize = 1000, esize = 20, cut = 0.1, minimum = 0, maximum = 1, borders = FALSE, vsize= 10, legend = FALSE)

If you can extend that code to the point where it reproduces your error we can figure out the problem.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/SachaEpskamp/qgraph/issues/51#issuecomment-783264522, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AS2P4G7CNGGH2N7SOGZICNDTAIVTDANCNFSM4XQ36KAQ.

lsnadeau commented 3 years ago

I'm adding more information about rstudio

rstudioapi::versionInfo() $citation

To cite RStudio in publications use:

RStudio Team (2020). RStudio: Integrated Development Environment for R. RStudio, PBC, Boston, MA URL http://www.rstudio.com/.

A BibTeX entry for LaTeX users is

@Manual{, title = {RStudio: Integrated Development Environment for R}, author = {{RStudio Team}}, organization = {RStudio, PBC}, address = {Boston, MA}, year = {2020}, url = {http://www.rstudio.com/}, }

$mode [1] "desktop"

$version [1] ‘1.3.1093’

$release_name [1] "Apricot Nasturtium"

Version of qgraph

packageVersion("qgraph")[1] ‘1.6.9’

The 4th first observation of the bfi dataset that I used dput(bdata2[1:4,]) structure(list(A1 = c(2L, 2L, 5L, 4L), A2 = c(4L, 4L, 4L, 4L), A3 = c(3L, 5L, 5L, 6L), A4 = c(4L, 2L, 4L, 5L), A5 = c(4L, 5L, 4L, 5L), C1 = c(2L, 5L, 4L, 4L), C2 = c(3L, 4L, 5L, 4L ), C3 = c(3L, 4L, 4L, 3L), C4 = c(4L, 3L, 2L, 5L), C5 = c(4L, 4L, 5L, 5L), E1 = c(3L, 1L, 2L, 5L), E2 = c(3L, 1L, 4L, 3L ), E3 = c(3L, 6L, 4L, 4L), E4 = c(4L, 4L, 4L, 4L), E5 = c(4L, 3L, 5L, 4L), N1 = c(3L, 3L, 4L, 2L), N2 = c(4L, 3L, 5L, 5L ), N3 = c(2L, 3L, 4L, 2L), N4 = c(2L, 5L, 2L, 4L), N5 = c(3L, 5L, 3L, 1L), O1 = c(3L, 4L, 4L, 3L), O2 = c(6L, 2L, 2L, 3L ), O3 = c(3L, 4L, 5L, 4L), O4 = c(4L, 3L, 5L, 3L), O5 = c(3L, 3L, 2L, 5L)), row.names = c(NA, 4L), class = "data.frame")

and the Compute polychoric correlations:

dput(btcorMat) structure(c(1, -0.40845072522919, -0.322534994540207, -0.17542796138817, -0.227855906050576, 0.00338022290150531, 0.00823880135729777, -0.0237128310819885, 0.153609897117526, 0.0605073445905763, 0.11767782718733, 0.111200375720246, -0.0668774340982724, -0.0770524730485401, -0.0250110827451967, 0.184071495565574, 0.157599819692691, 0.113338093728924, 0.0600922819398693, 0.0111411434049144, -0.00219488973357894, 0.083692047355312, -0.0906601520904744, -0.100352540936164, 0.136195610802798, -0.40845072522919, 1, 0.555458433280261, 0.389699147545801, 0.448824736349496, 0.115382706160093, 0.159706117954993, 0.22711675884859, -0.193306871055427, -0.156377359988479, -0.239529718194745, -0.272060735509787, 0.294978016229907, 0.317504381982443, 0.322790487934583, -0.11486872579201, -0.0671192334374541, -0.0471702253803139, -0.115519634667437, 0.0214067106371493, 0.16408541462196, -0.00180427164421131, 0.190845330418667, 0.112458354316386, -0.114857214482796, -0.322534994540207, 0.555458433280261, 1, 0.408057129570504, 0.572841645684758, 0.124207732100454, 0.158770048552652, 0.161416932547041, -0.164154431450698, -0.187689330001194, -0.250216018040367, -0.333326092646584, 0.452752024998062, 0.420595998812892, 0.293967656352481, -0.110530507000048, -0.0958025687224147, -0.0603045180873399, -0.147088009827957, -0.0452410037197774, 0.18624086622624, -0.0271008137322305, 0.26494986247808, 0.0607321562285621, -0.0770999453679185, -0.17542796138817, 0.389699147545801, 0.408057129570504, 1, 0.355267948545011, 0.109176678920492, 0.270532273610431, 0.168347639312913, -0.196338150517947, -0.283203470518255, -0.13716252513638, -0.211291698359744, 0.221329218777118, 0.348034229886854, 0.190651559709163, -0.120599235542214, -0.154978830874735, -0.0745425939596536, -0.191082468778672, -0.00660292698843281, 0.0760936866435515, 0.0346575925820618, 0.0806668189704019, -0.0448093920361592, 0.0242631908961083, -0.227855906050576, 0.448824736349496, 0.572841645684758, 0.355267948545011, 1, 0.157211860455217, 0.140696598254073, 0.154719689004687, -0.165191395738391, -0.199942406645241, -0.275418931444304, -0.383660053640273, 0.478069660797655, 0.525996557240064, 0.302470841001335, -0.225949355413018, -0.211263879021032, -0.156089938397737, -0.220998805924937, -0.0877815064050865, 0.201359904514984, -0.0111162392340621, 0.271712977242795, 0.0238985806744179, -0.0659686354034993, 0.00338022290150531, 0.115382706160093, 0.124207732100454, 0.109176678920492, 0.157211860455217, 1, 0.483160927402407, 0.34456226530737, -0.402339113671263, -0.292630121851316, -0.0285972172000304, -0.107860347201659, 0.142365375183762, 0.154628821270497, 0.279858226306097, -0.0832969138392508, -0.0469044417559331, -0.0382695114130622, -0.108102603475262, -0.0683571462272784, 0.210569960837643, -0.144615929627244, 0.221971284747031, 0.135686975847761, -0.163197323146781, 0.00823880135729777, 0.159706117954993, 0.158770048552652, 0.270532273610431, 0.140696598254073, 0.483160927402407, 1, 0.397221246166351, -0.432183922232435, -0.330938053154251, 0.0119741037365558, -0.0712302715943209, 0.183744832398228, 0.140657156179685, 0.292842957386705, -0.0193654400527341, 0.000590838071767851, 0.00566391481101162, -0.0391143260057959, 0.0527107787170832, 0.200962510836073, -0.0605274709906444, 0.222135991038895, 0.0735101720105925, -0.0921981096961722, -0.0237128310819885, 0.22711675884859, 0.161416932547041, 0.168347639312913, 0.154719689004687, 0.34456226530737, 0.397221246166351, 1, -0.381005823879698, -0.381436705731882, 0.00305539480973744, -0.0856654880557203, 0.103854643049832, 0.107854040583036, 0.246888609176707, -0.0749751637260222, -0.0638829038208722, -0.0752908621495415, -0.116987437914303, -0.0177219278664302, 0.110338843990225, -0.0384221836101039, 0.0730129442770303, 0.0319204817135418, -0.019539241600808, 0.153609897117526, -0.193306871055427, -0.164154431450698, -0.196338150517947, -0.165191395738391, -0.402339113671263, -0.432183922232435, -0.381005823879698, 1, 0.529978444609527, 0.10405173069964, 0.233822505292174, -0.104851026181364, -0.13335533998431, -0.280135976323902, 0.245662859811112, 0.183714441397665, 0.23981646514717, 0.293293561029336, 0.226530891052251, -0.112554195015304, 0.245451100257727, -0.104672555186331, 0.0595153507740293, 0.230574396375704, 0.0605073445905763, -0.156377359988479, -0.187689330001194, -0.283203470518255, -0.199942406645241, -0.292630121851316, -0.330938053154251, -0.381436705731882, 0.529978444609527, 1, 0.067641346273511, 0.292018438271398, -0.179069037663231, -0.223875003511747, -0.269440509846196, 0.232112062142674, 0.274947540551155, 0.269678324813815, 0.375258658823781, 0.203651718648595, -0.0989963516851542, 0.169077230473407, -0.0982043516949346, 0.1642848661326, 0.0672082576310994, 0.11767782718733, -0.239529718194745, -0.250216018040367, -0.13716252513638, -0.275418931444304, -0.0285972172000304, 0.0119741037365558, 0.00305539480973744, 0.10405173069964, 0.067641346273511, 1, 0.515381315679346, -0.350352525773296, -0.481359099349233, -0.333572381642719, 0.0218784236077433, 0.0129728412697728, 0.052083416035722, 0.249966764948959, 0.0537029642790918, -0.118369302888363, 0.0526701665049232, -0.241064055857597, 0.089463449755998, 0.098650598311229, 0.111200375720246, -0.272060735509787, -0.333326092646584, -0.211291698359744, -0.383660053640273, -0.107860347201659, -0.0712302715943209, -0.0856654880557203, 0.233822505292174, 0.292018438271398, 0.515381315679346, 1, -0.421881255671979, -0.57463815512736, -0.420829955348233, 0.183650392761085, 0.205665630017704, 0.214339195750653, 0.379065849381506, 0.280809372501722, -0.187173911773421, 0.0988177272353197, -0.257126223757293, 0.207665904495383, 0.0880322333218724, -0.0668774340982724, 0.294978016229907, 0.452752024998062, 0.221329218777118, 0.478069660797655, 0.142365375183762, 0.183744832398228, 0.103854643049832, -0.104851026181364, -0.179069037663231, -0.350352525773296, -0.421881255671979, 1, 0.461276200359194, 0.432050918643011, -0.0585814741969427, -0.0684634378868069, -0.0208668996880158, -0.158543459408106, -0.0921454780873075, 0.379052473257295, -0.0933632147288152, 0.437349449642628, 0.0753847166425374, -0.14552888239251, -0.0770524730485401, 0.317504381982443, 0.420595998812892, 0.348034229886854, 0.525996557240064, 0.154628821270497, 0.140657156179685, 0.107854040583036, -0.13335533998431, -0.223875003511747, -0.481359099349233, -0.57463815512736, 0.461276200359194, 1, 0.347710170518931, -0.152514236354274, -0.153680911892982, -0.117717014995973, -0.320638790074835, -0.113144285050686, 0.164907733034766, 0.0539450152903843, 0.233987220966304, -0.115926407530645, 0.05688165432528, -0.0250110827451967, 0.322790487934583, 0.293967656352481, 0.190651559709163, 0.302470841001335, 0.279858226306097, 0.292842957386705, 0.246888609176707, -0.280135976323902, -0.269440509846196, -0.333572381642719, -0.420829955348233, 0.432050918643011, 0.347710170518931, 1, 0.0471440901624641, 0.0482691834114875, -0.064328087917546, -0.22733628080631, -0.153845444866445, 0.347865909832072, -0.111390659663326, 0.332201519831562, 0.0016826142135295, -0.149222864183199, 0.184071495565574, -0.11486872579201, -0.110530507000048, -0.120599235542214, -0.225949355413018, -0.0832969138392508, -0.0193654400527341, -0.0749751637260222, 0.245662859811112, 0.232112062142674, 0.0218784236077433, 0.183650392761085, -0.0585814741969427, -0.152514236354274, 0.0471440901624641, 1, 0.764239678401427, 0.607521418319414, 0.436947241879599, 0.419607352895156, -0.0641105219890962, 0.14179538541356, -0.0598205713331517, 0.0947598379644517, 0.119132297501362, 0.157599819692691, -0.0671192334374541, -0.0958025687224147, -0.154978830874735, -0.211263879021032, -0.0469044417559331, 0.000590838071767851, -0.0638829038208722, 0.183714441397665, 0.274947540551155, 0.0129728412697728, 0.205665630017704, -0.0684634378868069, -0.153680911892982, 0.0482691834114875, 0.764239678401427, 1, 0.597040600057271, 0.429125507329192, 0.384852492275484, -0.0497347196645301, 0.142594249822546, -0.0325178310794009, 0.155396976052107, 0.0371820189769119, 0.113338093728924, -0.0471702253803139, -0.0603045180873399, -0.0745425939596536, -0.156089938397737, -0.0382695114130622, 0.00566391481101162, -0.0752908621495415, 0.23981646514717, 0.269678324813815, 0.052083416035722, 0.214339195750653, -0.0208668996880158, -0.117717014995973, -0.064328087917546, 0.607521418319414, 0.597040600057271, 1, 0.564343522038429, 0.470359484018177, -0.0432686311411292, 0.116193719735181, -0.0302359472886761, 0.205388672250946, 0.058764594419129, 0.0600922819398693, -0.115519634667437, -0.147088009827957, -0.191082468778672, -0.220998805924937, -0.108102603475262, -0.0391143260057959, -0.116987437914303, 0.293293561029336, 0.375258658823781, 0.249966764948959, 0.379065849381506, -0.158543459408106, -0.320638790074835, -0.22733628080631, 0.436947241879599, 0.429125507329192, 0.564343522038429, 1, 0.440264983841415, -0.0487660921641979, 0.0917193169852136, -0.0679346108592007, 0.259582600182191, 0.0415705078826088, 0.0111411434049144, 0.0214067106371493, -0.0452410037197774, -0.00660292698843281, -0.0877815064050865, -0.0683571462272784, 0.0527107787170832, -0.0177219278664302, 0.226530891052251, 0.203651718648595, 0.0537029642790918, 0.280809372501722, -0.0921454780873075, -0.113144285050686, -0.153845444866445, 0.419607352895156, 0.384852492275484, 0.470359484018177, 0.440264983841415, 1, -0.141952896999538, 0.227930486874359, -0.0982829265746635, 0.140549331793399, 0.155971125676953, -0.00219488973357894, 0.16408541462196, 0.18624086622624, 0.0760936866435515, 0.201359904514984, 0.210569960837643, 0.200962510836073, 0.110338843990225, -0.112554195015304, -0.0989963516851542, -0.118369302888363, -0.187173911773421, 0.379052473257295, 0.164907733034766, 0.347865909832072, -0.0641105219890962, -0.0497347196645301, -0.0432686311411292, -0.0487660921641979, -0.141952896999538, 1, -0.262773054342946, 0.450229538431314, 0.248793031658823, -0.301046830481263, 0.083692047355312, -0.00180427164421131, -0.0271008137322305, 0.0346575925820618, -0.0111162392340621, -0.144615929627244, -0.0605274709906444, -0.0384221836101039, 0.245451100257727, 0.169077230473407, 0.0526701665049232, 0.0988177272353197, -0.0933632147288152, 0.0539450152903843, -0.111390659663326, 0.14179538541356, 0.142594249822546, 0.116193719735181, 0.0917193169852136, 0.227930486874359, -0.262773054342946, 1, -0.317558477268609, -0.0972905182407821, 0.373605684506686, -0.0906601520904744, 0.190845330418667, 0.26494986247808, 0.0806668189704019, 0.271712977242795, 0.221971284747031, 0.222135991038895, 0.0730129442770303, -0.104672555186331, -0.0982043516949346, -0.241064055857597, -0.257126223757293, 0.437349449642628, 0.233987220966304, 0.332201519831562, -0.0598205713331517, -0.0325178310794009, -0.0302359472886761, -0.0679346108592007, -0.0982829265746635, 0.450229538431314, -0.317558477268609, 1, 0.253009579729775, -0.375930709348172, -0.100352540936164, 0.112458354316386, 0.0607321562285621, -0.0448093920361592, 0.0238985806744179, 0.135686975847761, 0.0735101720105925, 0.0319204817135418, 0.0595153507740293, 0.1642848661326, 0.089463449755998, 0.207665904495383, 0.0753847166425374, -0.115926407530645, 0.0016826142135295, 0.0947598379644517, 0.155396976052107, 0.205388672250946, 0.259582600182191, 0.140549331793399, 0.248793031658823, -0.0972905182407821, 0.253009579729775, 1, -0.243858200693562, 0.136195610802798, -0.114857214482796, -0.0770999453679185, 0.0242631908961083, -0.0659686354034993, -0.163197323146781, -0.0921981096961722, -0.019539241600808, 0.230574396375704, 0.0672082576310994, 0.098650598311229, 0.0880322333218724, -0.14552888239251, 0.05688165432528, -0.149222864183199, 0.119132297501362, 0.0371820189769119, 0.058764594419129, 0.0415705078826088, 0.155971125676953, -0.301046830481263, 0.373605684506686, -0.375930709348172, -0.243858200693562, 1), .Dim = c(25L, 25L), .Dimnames = list( c("A1", "A2", "A3", "A4", "A5", "C1", "C2", "C3", "C4", "C5", "E1", "E2", "E3", "E4", "E5", "N1", "N2", "N3", "N4", "N5", "O1", "O2", "O3", "O4", "O5"), c("A1", "A2", "A3", "A4", "A5", "C1", "C2", "C3", "C4", "C5", "E1", "E2", "E3", "E4", "E5", "N1", "N2", "N3", "N4", "N5", "O1", "O2", "O3", "O4", "O5")))

thank you

Lyne


De : Sacha Epskamp notifications@github.com Envoyé : 22 février 2021 05:19 À : SachaEpskamp/qgraph qgraph@noreply.github.com Cc : Lyne Nadeau, Mlle lyne.nadeau@mcgill.ca; Author author@noreply.github.com Objet : Re: [SachaEpskamp/qgraph] Flow function in qgraph error edgeConnectPoints (#51)

I meant perhaps you can try to make a minimal reproducible example. See for some details herehttps://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example. For example, this code runs for me:

library("qgraph")

corMat_n <- matrix(0.1,6,6) diag(corMat_n) <- 1

qgraph(corMat_n, graph = "glasso", sampleSize = 1000, esize = 20, cut = 0.1, minimum = 0, maximum = 1, borders = FALSE, vsize= 10, legend = FALSE)

If you can extend that code to the point where it reproduces your error we can figure out the problem.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/SachaEpskamp/qgraph/issues/51#issuecomment-783264522, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AS2P4G7CNGGH2N7SOGZICNDTAIVTDANCNFSM4XQ36KAQ.

SachaEpskamp commented 3 years ago

Thanks! I can replicate this. Can you try with the new devel version?


library("devtools")
install_github("sachaepskamp/qgraph")
lsnadeau commented 3 years ago

Hello, I'm not sure i'm doing it right or in the right order. Maybe i should uninstall everything. Below are steps I did but I think I was unable to update qgraph. I still get the same error. Thanks a lot for your help.

I first ran library("devtools") and got this

library(devtools) Loading required package: usethis

library("devtools") bdata<-read.csv("bfi.csv")

bdata2 <- bdata[,2:26] # Select only variables bcorMat <- cor_auto(bdata2) # Correlate data Variables detected as ordinal: A1; A2; A3; A4; A5; C1; C2; C3; C4; C5; E1; E2; E3; E4; E5; N1; N2; N3; N4; N5; O1; O2; O3; O4; O5

Glasso network:

g2 <- qgraph(bcorMat, cut = 0, graph = "glasso", sampleSize = nrow(bdata2),

  • threshold = TRUE)

    Flow from A2:

    flow(g2, "A2", horizontal = TRUE) Error in qgraph(object, layout = Layout, curve = Curve, edgeConnectPoints = ECP, : Number of rows in 'edgeConnectPoints' do not match number of edges

    }

So I run the installation you suggest

install_github("sachaepskamp/qgraph") WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/. Downloading GitHub repo sachaepskamp/qgraph@HEAD WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/. trying URL 'https://cran.rstudio.com/bin/windows/Rtools/rtools40-x86_64.exe' Content type 'application/x-msdownload' length 132205064 bytes (126.1 MB) downloaded 126.1 MB

Error: Failed to install 'qgraph' from GitHub: Could not find tools necessary to compile a package Call pkgbuild::check_build_tools(debug = TRUE) to diagnose the problem.

detach("package:devtools", unload = TRUE) detach("package:psych", unload = TRUE) Warning message: ‘psych’ namespace cannot be unloaded: namespace ‘psych’ is imported by ‘qgraph’, ‘NetworkToolbox’, ‘networktools’ so cannot be unloaded detach("package:qgraph", unload = TRUE) Warning message: ‘qgraph’ namespace cannot be unloaded: namespace ‘qgraph’ is imported by ‘IsingFit’, ‘bootnet’, ‘mgm’ so cannot be unloaded detach("package:sas7bdat", unload = TRUE) install.packages("Rtools") Installing package into ‘C:/Users/Nancy Mayo/Documents/R/win-library/4.0’ (as ‘lib’ is unspecified) Warning in install.packages : package ‘Rtools’ is not available for this version of R

A version of this package for your version of R might be available elsewhere, see the ideas at https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

Then I tried those lines. I'm not sure what I'm doing exactly.

pkgbuild::check_build_tools(debug = TRUE) Scanning R CMD config CC... cc_path: '' does not exist Scanning path... Scanning registry... Found C:/RBuildTools/4.0 for 4.0 Your system is ready to build packages! install.packages("Rtools") Installing package into ‘C:/Users/Nancy Mayo/Documents/R/win-library/4.0’ (as ‘lib’ is unspecified) Warning in install.packages : package ‘Rtools’ is not available for this version of R

A version of this package for your version of R might be available elsewhere, see the ideas at https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

library("devtools") install_github("sachaepskamp/qgraph") Downloading GitHub repo sachaepskamp/qgraph@HEAD These packages have more recent versions available. It is recommended to update all of them. Which would you like to update?

1: All 2: CRAN packages only 3: None 4: pillar (1.4.7 -> 1.5.0 ) [CRAN] 5: lifecycle (0.2.0 -> 1.0.0 ) [CRAN] 6: crayon (1.4.0 -> 1.4.1 ) [CRAN] 7: waldo (0.2.3 -> 0.2.4 ) [CRAN] 8: pkgload (1.1.0 -> 1.2.0 ) [CRAN] 9: testthat (3.0.1 -> 3.0.2 ) [CRAN] 10: mime (0.9 -> 0.10 ) [CRAN] 11: xfun (0.20 -> 0.21 ) [CRAN] 12: backports (1.2.0 -> 1.2.1 ) [CRAN] 13: data.table (1.13.6 -> 1.14.0) [CRAN] 14: dplyr (1.0.3 -> 1.0.4 ) [CRAN]

Enter one or more numbers, or an empty line to skip updates:1 pillar (1.4.7 -> 1.5.0 ) [CRAN] lifecycle (0.2.0 -> 1.0.0 ) [CRAN] crayon (1.4.0 -> 1.4.1 ) [CRAN] waldo (0.2.3 -> 0.2.4 ) [CRAN] pkgload (1.1.0 -> 1.2.0 ) [CRAN] testthat (3.0.1 -> 3.0.2 ) [CRAN] mime (0.9 -> 0.10 ) [CRAN] xfun (0.20 -> 0.21 ) [CRAN] backports (1.2.0 -> 1.2.1 ) [CRAN] data.table (1.13.6 -> 1.14.0) [CRAN] dplyr (1.0.3 -> 1.0.4 ) [CRAN] Installing 11 packages: pillar, lifecycle, crayon, waldo, pkgload, testthat, mime, xfun, backports, data.table, dplyr Installing packages into ‘C:/Users/Nancy Mayo/Documents/R/win-library/4.0’ (as ‘lib’ is unspecified)

There are binary versions available but the source versions are later: binary source needs_compilation pillar 1.4.7 1.5.0 FALSE pkgload 1.1.0 1.2.0 TRUE data.table 1.13.6 1.14.0 TRUE

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/lifecycle_1.0.0.zip' Content type 'application/zip' length 111193 bytes (108 KB) downloaded 108 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/crayon_1.4.1.zip' Content type 'application/zip' length 142313 bytes (138 KB) downloaded 138 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/waldo_0.2.4.zip' Content type 'application/zip' length 72194 bytes (70 KB) downloaded 70 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/testthat_3.0.2.zip' Content type 'application/zip' length 2496093 bytes (2.4 MB) downloaded 2.4 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/mime_0.10.zip' Content type 'application/zip' length 48442 bytes (47 KB) downloaded 47 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/xfun_0.21.zip' Content type 'application/zip' length 319389 bytes (311 KB) downloaded 311 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/backports_1.2.1.zip' Content type 'application/zip' length 98506 bytes (96 KB) downloaded 96 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/dplyr_1.0.4.zip' Content type 'application/zip' length 1329695 bytes (1.3 MB) downloaded 1.3 MB

package ‘lifecycle’ successfully unpacked and MD5 sums checked package ‘crayon’ successfully unpacked and MD5 sums checked package ‘waldo’ successfully unpacked and MD5 sums checked package ‘testthat’ successfully unpacked and MD5 sums checked Error: Failed to install 'qgraph' from GitHub: (converted from warning) cannot remove prior installation of package ‘testthat’


De : Sacha Epskamp notifications@github.com Envoyé : 23 février 2021 09:29 À : SachaEpskamp/qgraph qgraph@noreply.github.com Cc : Lyne Nadeau, Mlle lyne.nadeau@mcgill.ca; Author author@noreply.github.com Objet : Re: [SachaEpskamp/qgraph] Flow function in qgraph error edgeConnectPoints (#51)

Thanks! I can replicate this. Can you try with the new devel version?

library("devtools") install_github("sachaepskamp/qgraph")

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/SachaEpskamp/qgraph/issues/51#issuecomment-784242151, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AS2P4G4SM42BVPHWBAER4JDTAO3WPANCNFSM4XQ36KAQ.

SachaEpskamp commented 3 years ago

You need to install Rtools to compile from source: https://cran.r-project.org/bin/windows/Rtools/. When asked about installing any other package from source, say "no".

lsnadeau commented 3 years ago

Hello, I installed Rtools from the link you gave. Then I ran install_github("sachaepskamp/qgraph") and got this

install_github("sachaepskamp/qgraph") Downloading GitHub repo sachaepskamp/qgraph@HEAD These packages have more recent versions available. It is recommended to update all of them. Which would you like to update?

1: All
2: CRAN packages only
3: None
4: pillar (1.4.7 -> 1.5.1 ) [CRAN] 5: isoband (0.2.3 -> 0.2.4 ) [CRAN] 6: mime (0.9 -> 0.10 ) [CRAN] 7: xfun (0.20 -> 0.21 ) [CRAN] 8: backports (1.2.0 -> 1.2.1 ) [CRAN] 9: data.table (1.13.6 -> 1.14.0) [CRAN] 10: dplyr (1.0.3 -> 1.0.5 ) [CRAN] 11: Hmisc (4.4-2 -> 4.5-0 ) [CRAN]

then I selected 1 to install ALL and got this

Enter one or more numbers, or an empty line to skip updates:1 pillar (1.4.7 -> 1.5.1 ) [CRAN] tibble (NA -> 3.1.0 ) [CRAN] isoband (0.2.3 -> 0.2.4 ) [CRAN] mime (0.9 -> 0.10 ) [CRAN] xfun (0.20 -> 0.21 ) [CRAN] backports (1.2.0 -> 1.2.1 ) [CRAN] data.table (1.13.6 -> 1.14.0) [CRAN] dplyr (1.0.3 -> 1.0.5 ) [CRAN] Hmisc (4.4-2 -> 4.5-0 ) [CRAN] Installing 9 packages: pillar, tibble, isoband, mime, xfun, backports, data.table, dplyr, Hmisc Installing packages into ‘C:/Users/Nancy Mayo/Documents/R/win-library/4.0’ (as ‘lib’ is unspecified)

There are binary versions available but the source versions are later: binary source needs_compilation pillar 1.5.0 1.5.1 FALSE isoband 0.2.3 0.2.4 TRUE dplyr 1.0.4 1.0.5 TRUE

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/tibble_3.1.0.zip' Content type 'application/zip' length 824384 bytes (805 KB) downloaded 805 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/mime_0.10.zip' Content type 'application/zip' length 48442 bytes (47 KB) downloaded 47 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/xfun_0.21.zip' Content type 'application/zip' length 319648 bytes (312 KB) downloaded 312 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/backports_1.2.1.zip' Content type 'application/zip' length 98506 bytes (96 KB) downloaded 96 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/data.table_1.14.0.zip' Content type 'application/zip' length 2602450 bytes (2.5 MB) downloaded 2.5 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/Hmisc_4.5-0.zip' Content type 'application/zip' length 3247541 bytes (3.1 MB) downloaded 3.1 MB

package ‘tibble’ successfully unpacked and MD5 sums checked Error: Failed to install 'qgraph' from GitHub: (converted from warning) cannot remove prior installation of package ‘tibble’

Should I uninstall qgraph before running this install_github("sachaepskamp/qgraph") ? Thank you Lyne

SachaEpskamp commented 2 years ago

Sorry I missed this. You can select none when asked which packages should be updated. I think this is fixed now so I will close the issue.