Skip to content

Median aggregation is not computing the right value #2588

Description

@sgratzl

Describe the bug (required)

looking at the aggregation code I notice that the median aggregation function is not computing the correct value:

https://github.com/tannerlinsley/react-table/blob/aa2835766a7a34f70cd6b579628e4f7e820970ab/src/aggregations.js#L52-L68

see also https://en.wikipedia.org/wiki/Median

Provide an example via Codesandbox! (required)
https://codesandbox.io/s/angry-lehmann-kb9vx?file=/src/App.js

Steps To Reproduce (required)
Steps to reproduce the behavior:

  1. Go to 'https://codesandbox.io/s/angry-lehmann-kb9vx?file=/src/App.js
  2. Click on "group by status"
  3. Compare median values of different groups

Expected behavior (Recommended)
I would expect that these two median values are equal

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions