Skip to content

Instantly share code, notes, and snippets.

@mneedham
Forked from mhermans/neo4R_example.R
Created November 3, 2013 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mneedham/7292917 to your computer and use it in GitHub Desktop.
Save mneedham/7292917 to your computer and use it in GitHub Desktop.
library('RCurl')
library('RJSONIO')
query <- function(querystring) {
h = basicTextGatherer()
curlPerform(url="http://localhost:7474/db/data/cypher",
postfields=paste('query',curlEscape(querystring), sep='='),
writefunction = h$update,
verbose = FALSE
)
result <- fromJSON(h$value())
data <- data.frame(t(sapply(result$data, unlist)))
names(data) <- result$columns
data
}
data <- query("START n = node(*) RETURN COUNT(n) AS count")
results <- data.frame(table(data$count))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment