0
RNeo4j
패키지를 사용하여 R로 그래프 데이터베이스를 만들려고합니다. 기본적으로 @Nicloe White가 here을 보여준 것은 RStudio IDE를 통해 전적으로 달성하고자하는 작업입니다. 나는 data을 R로 읽고 lubridate
패키지를 사용하여 날짜 필드에 몇 가지 기본 관리 작업을 수행했습니다. 그 후 Nicole이 hflights
데이터 세트에 대해 here을 표시 한 것을 따릅니다.RNeo4j에서 'appendCypher()'를 사용하는 중 오류가 발생했습니다
for
루프를 실행할 때
query="
CREATE (complaint:Complaint {id: TOINT({ComplaintID})})
SET complaint.day = ({ComplaintDay}),
complaint.month = ({ComplaintMonth}),
complaint.year = ({ComplaintYear})
MERGE (company:Company {name:{CompanyName}})
MERGE (response:Response {name:{Companyresponsetoconsumer}})
CREATE (complaint) -[:AGAINST]-> (company)
CREATE (response) -[r:TO]-> (complaint)
SET r.timely = CASE {Timelyresponse} WHEN 'Yes' THEN true ELSE false END,
r.disputed = CASE {Consumerdisputed} WHEN 'Yes' THEN true ELSE false END
"
tx = newTransaction(graph)
for(i in 1:nrow(complaint)) {
row = complaint[i, ]
appendCypher(tx, query,
ComplaintID=complaint$Complaint.ID,
ComplaintDay=complaint$Complaint.Day,
ComplaintMonth=complaint$Complaint.Month,
ComplaintYear=complaint$Complaint.Year,
CompanyName=complaint$Company,
Companyresponsetoconsumer=complaint$Company.response.to.consumer,
Timelyresponse=complaint$Timely.response.,
Consumerdisputed=complaint$Consumer.disputed.)
}
commit(tx)
summary(graph)
그러나, 내가받을 다음과 같은 오류 :
Error in appendCypher.transaction(tx, query, ComplaintID =
complaint$Complaint.ID, :
Neo.ClientError.Statement.TypeError
Expected a String or Number, got: List(1913026, 99413, 1420666, 1139505, 850511, 211452, 299293, 967118, 1342525, 218870, 936088, 1577433, 396460, 976892, 1713179, 985796, 1274906, 1524883, 549683, 375379, 2083877, 1804301, 568928, 643695, 2013448, 1822596, 1054868, 1058533, 1972148, 1053127, 1546919, 1974786, 1386150, 558306, 2029982, 1812827, 2112000, 1279031, 1729024, 811685, 423229, 211371, 550247, 1837165, 589977, 363963, 773706, 1422738, 362615, 1918434, 31932, 101419, 109634, 799711, 568707, 425802, 1354727, 905367, 433560, 950090, 1615178, 1085081, 1842311, 55218, 82206, 8990, 1716274, 1199075, 315208, 976080, 1747751, 1424814, 757803, 61250, 592018, 974917, 2046258, 1901776, 123518, 1362552, 257123, 1212622, 1663172, 1200587, 84365, 358901, 1920239, 691273, 226122, 36142, 1615314, 809300, 1987176, 596079, 1619346, 1261257, 984128, 793228, 173250, 249440, 192131, 1759419, 1394747, 1316550, 1890080, 862502, 1192961, 506058, 2000389,
상태 코드는 아마도 complaint$Complaint.ID
유형이 지원되지 않았 음을 나타냅니다이 관련 코드입니다. 그러나 TOINT
은 이것을 처리하지 않습니까?
여기 좀 도와 주시면 감사하겠습니다.
당신이 ComplaintID에서 목록을 전달하고, 그것이 문자열이나 숫자 –
'str을 (불만 $ Complaint.ID)를 기대하고있다'는 정수이다 것을 알 수있다. – Dhiraj