jtextor / dagitty

Graphical analysis of structural causal models / graphical causal models.
GNU General Public License v2.0
282 stars 46 forks source link

convert a Neo4j connection object into a DAGitty object #41

Open ghost opened 3 years ago

ghost commented 3 years ago

I am having problem to convert a neo4j connection object into a dagitty object.

using as.dagitty(con)

where con is a connection object using neo4r package.

Returned result is: Error in as.vector(x, "character") : cannot coerce type 'environment' to vector of type 'character' In addition: Warning message: In if (class(x) == "dagitty") { : the condition has length > 1 and only the first element will be used

Would anyone enlighten me in this regard?

jtextor commented 3 years ago

There would need to specific code to convert a neo4j graph to DAGitty. If you send me a complete example of what you are trying to accomplish, perhaps I can write one

ghost commented 3 years ago

Thanks for willing to help. Appreciated! This is the code and what I am trying to do:

Connect ne4j database with R

library(neo4r) con <- neo4j_api$new( url = "http://localhost:7474" , db = "neo4j", user = "neo4j",password = "123", isV4 = TRUE ) contest <- con$ping() contest

path analysis using dagitty

library(dagitty) as.dagitty(con) # not working. I was thinking if I could convert the neo4r connection object as a dag graph, then I could using dagitty to analyze that graph g1<-getExample("Shrier") paths(backDoorGraph(g1)) # here I am using the dagitty example to test, but I want to put a neo4j graph here.

Please ignore the following if you have no problem with connection neo4j with r. library(devtools) install_github("davidlrosenblum/neo4r@4.x”) library(neo4r) packageVersion('neo4r') # this should be ‘4.0.0’ con <- neo4j_api$new( url = "http://localhost:7474",db = 'neo4j', user = "neo4j",password = “what your password is”, isV4 = TRUE )

Make sure the Neo4j database version is 4.0.8 or above

ghost commented 3 years ago

There would need to specific code to convert a neo4j graph to DAGitty. If you send me a complete example of what you are trying to accomplish, perhaps I can write one

Hi there,

I do not mean to push, but just wondering if there is any progress? :)