The popular Neo4j graph Neo4j can be used in R thanks to the RNeo4j package / driver ( https://github.com/nicolewhite/Rneo4j ).
The author of the package, @ NicoleWhite , provides some excellent examples of its use on GitHub .
Unfortunately, for me, the examples provided by @NicoleWhite and the documentation are a bit simplified, as they manually create each node graph and its associated labels and properties , such as:
mugshots = createNode(graph, "Bar", name = "Mugshots", location = "Downtown") parlor = createNode(graph, "Bar", name = "The Parlor", location = "Hyde Park") nicole = createNode(graph, name = "Nicole", status = "Student") addLabel(nicole, "Person")
That all is well and good when you are dealing with a tiny set of sample data, but this approach is not possible for something like a large social graph with thousands of users, where each user is a node (such graphs may not use every node in every request, but they still need to be entered in Neo4j ).
I am trying to figure out how to do this using vectors or dataframes. Is there a solution, perhaps including an apply statement or a for loop?
This basic attempt:
for (i in 1:length(df$user_id)){ paste(df$user_id[i]) = createNode(graph, "user", name = df$name[i], email = df$email[i]) }
Leads to Error: 400 Bad Request
r neo4j graph-databases r-neo4j
Hack-r
source share