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

RXR-819: return percentile when weight is right at 0.1st #33

Merged
merged 5 commits into from
Feb 4, 2022
Merged

Conversation

karawoo
Copy link
Contributor

@karawoo karawoo commented Feb 3, 2022

We were returning NA as the percentile when the provided value was exactly at the 0.1st percentile. The reason was that tail(as.num(tmp[value > as.num(tmp)]),1) did not include any values, so the data data frame had only one row. Therefore when we fit lm() there was an intercept but the slope was NA, and when we added as.num(par[1] + par[2]*value) that produced NA. This fixes it by using <= and >=, rather than < and >, to check for values at the 99.9th or 0.1st percentile.

Copy link
Contributor

@jasmineirx jasmineirx left a comment

Choose a reason for hiding this comment

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

good find! minor suggestion

R/pct_for_age_generic.R Outdated Show resolved Hide resolved
R/pct_for_age_generic.R Outdated Show resolved Hide resolved
karawoo and others added 2 commits February 3, 2022 14:48
Co-authored-by: Jasmine Hughes <43552465+jasmineirx@users.noreply.github.com>
@karawoo karawoo merged commit 86db1a0 into master Feb 4, 2022
@karawoo karawoo deleted the RXR-819 branch February 4, 2022 17:53
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.

None yet

2 participants