Hi
I spent a long time looking for an aggregation function to calculate the MODE function like in SQL witch take the max of occurence of a set
for example I make a collet function for a variable X: collect(X) and it turns the following set [0,1,1,0,0,1,1]
now I want to know the value that takes the max number of occurence .in my example the value 1 has the max number of occurence
so my request must return the value 1
please can someone help me to resolve this problem
My queries are looking like the following:
MATCH (N0:user)
OPTIONAL MATCH (N0:user)-[R0:rating]-()
WITH N0, N0.gender as AN0, R0.likes as AR4,count(R0.likes) as AR0,R0
order by ID(N0),AR4, AN0, AR0 desc
with collect(R0.likes) as AR2,AN0 as AN0, AR0 as AR0,N0
RETURN distinct ID(N0),AN0, AR0, AR2
but this query just return the collect function of rationg.likes witch is a set of binaries variables (for example[0,0,1,0,1,1,1])
if I make head(collect(rating.likes)) it doesn't return the value that has the max occurence in the collection
please help