提问人:LenaLD 提问时间:11/16/2016 最后编辑:Gabor SzarnyasLenaLD 更新时间:11/17/2016 访问量:421
Neo4j:错误:R markdown 中“LOAD CSV”中的意外符号
Neo4j: Error: unexpected symbol in "LOAD CSV" in R markdown
问:
我正在阅读 [将 CSV 数据导入 Neo4j][1],我试图执行
library("RNeo4j")
library("curl")
graph <- startGraph("http://localhost:7474/db/data", username = "neo4j", password = "")
clear(graph, input = F)
LOAD CSV WITH HEADERS FROM "file:///data//airlines.csv" AS row
CREATE (n:airlines)
SET n = row,
n.carrier = toFloat(row.carrier),
n.name = toFloat(row.name)
我收到以下错误消息:
> > LOAD CSV WITH HEADERS FROM "file:///data//airlines.csv" AS row
Error: unexpected symbol in "LOAD CSV"
> CREATE (n:airlines)
Error: could not find function "CREATE"
> SET n = row,
Error: unexpected symbol in "SET n"
> n.carrier = toFloat(row.carrier),
Error: unexpected ',' in " n.carrier = toFloat(row.carrier),"
> n.name = toFloat(row.name)
Error: could not find function "toFloat"
>
答:
0赞
Gabor Szarnyas
11/17/2016
#1
要熟悉 RNeo4j 包,您应该查看 RNeo4j GitHub 存储库中的 README 和参考手册。
您应该将查询放在多行字符串中并使用该函数。请注意,我在 Cypher 查询中将引号更改为撇号 ()。cypher
'
我还删除了库的导入,因为它是可传递导入的。curl
RNeo4j
library("RNeo4j")
graph = startGraph("http://localhost:7474/db/data", username = "neo4j", password = "")
clear(graph, input = F)
query = "
LOAD CSV WITH HEADERS FROM 'file:///data//airlines.csv' AS row
CREATE (n:airlines)
SET n = row,
n.carrier = toFloat(row.carrier),
n.name = toFloat(row.name)
"
cypher(graph, query)
请确保提供 CSV 文件的绝对路径,如 Neo4j CSV 导入指南中所示。
评论
LOAD CSV