Skip to content

Aggregation Median incorrect calculation #4582

Description

@timsun28

Describe the bug

The current implementation of calculation of the median is incorrect.
This bug has been report before here, and it was fixed in the following commit.

However, if you now go to the current file the old version is back again.

Your minimal, reproducible example

https://codesandbox.io/s/exciting-sun-ddlcoz?file=/src/main.tsx

Steps to reproduce

Go to the given sandbox and click on the hand icon with More info. This will turn the table into a grouped view and will calculate the median for the age column and for the progress column.

Expected behavior

With the fixed data set it should be: age 15 and profile progress should be 20%. Those are the middle values of the three options. An alternative test case would be to add one more row and see if it calculates the average correctly of the two middle rows.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Any platform - version 8.7.1

react-table version

v8.7.1

TypeScript version

No response

Additional context

No response

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions