Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add median of a column or a range #76

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lulunac27a
Copy link

Add the medium of the values from a column or range

Add the medium of the values from a column or range
Copy link
Owner

@tgrosinger tgrosinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the pull request. Just a minor change to make it easier to read.

middleIndex = (sortedValues.length - 1) / 2;
isEven = false;
}
return new Value([[(isEven ? (sortedValues[middleIndex - 1] + sortedValues[middleIndex]) / 2 : sortedValues[middleIndex]).toString()]]);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be refactored to instead have two simpler return statements in the if and else blocks? I think that might make it a bit easier to read.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would agree with this refactoring idea to make the code easier to read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants