This function takes a Cypher query and parameters, executes the query using the given engine, and returns the result as a data frame.
cypher_query_df(engine, query, parameters = NULL, ...)
A neo4j_engine() or derivative providing access to a Neo4j database.
A string representing the Cypher query, which should return a table. Multiple queries may be passed as a vector; if so, Neo2R::multicypher if used and the result is returned as a list of data frames.
A list of parameters for the Cypher query, if required.
Additional arguments passed to the function.
The result of the Cypher query as a data frame, or a list of data frames if multiple queries are passed.
engine <- monarch_engine()
#> Trying to connect to https://neo4j.monarchinitiative.org
#> Connected to https://neo4j.monarchinitiative.org
query <- "MATCH (n) WHERE n.id IN $ids RETURN n LIMIT 10"
parameters <- list(ids = c("MONDO:0007525", "MONDO:0020066", "MONDO:0034021"))
result <- cypher_query_df(engine, query, parameters)
print(result)
#> n
#> 1 http://p....
#> 2 http://p....
#> 3 http://p....