neo4j-rstats / neo4r

A Modern and Flexible Neo4J Driver
https://neo4j-rstats.github.io/user-guide/
Other
106 stars 30 forks source link

call_neo4j fails #60

Open Btibert3 opened 5 years ago

Btibert3 commented 5 years ago

The following query:

MATCH (p:Play)
WITH  p
RETURN p.eventTypeId, count(*) as total
LIMIT 5

returns (via Desktop Browser)

╒════════════════╤═══════╕
│"p.eventTypeId" │"total"│
╞════════════════╪═══════╡
│"GAME_SCHEDULED"│1354   │
├────────────────┼───────┤
│"PERIOD_READY"  │4445   │
├────────────────┼───────┤
│"PERIOD_START"  │4462   │
├────────────────┼───────┤
│"FACEOFF"       │80269  │
├────────────────┼───────┤
│"HIT"           │62512  │
└────────────────┴───────┘

However, when I try to pull this data into R using:

CYPHER = "
MATCH (p:Play)
WITH  p
RETURN p.eventTypeId, count(*) as total
LIMIT 5
"
event_types = call_neo4j(CYPHER, graph, type="row")

I get the following error:

Error in names(object) <- nm : 
  'names' attribute [2] must be the same length as the vector [1]

if I attempt:

event_types = call_neo4j(CYPHER, graph, type="graph")

the error is:

No graph data found.
Either your call can't be converted to a graph 
or there is no data at all matching your call.
Verify your call or try type = "row".

Lastly, if I attempt:

event_types = call_neo4j(CYPHER, graph, type="row", output="json")

there is no error, but I now need to parse the JSON as opposed to a one line call using the older package.