-
Notifications
You must be signed in to change notification settings - Fork 20
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
santize w_dens #86
base: master
Are you sure you want to change the base?
santize w_dens #86
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for getting this started, and well done on your first PR! I would recommend:
- implementing the feature as a separate function in a dedicated file in R/
- adding a warning (already added to the code as suggestion); note we may want to check if we need to add a 'quiet' option
- the test needs to use testthat syntax
Looking forward to discussing these points :)
tests/test_w_dens.R
Outdated
@@ -0,0 +1,58 @@ | |||
here::here() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a specific syntax for test to use in a package, using testthat. See other test files in this project for some examples. Here, the additional tests should include:
- testing that the warning is issued when it should, and that it is the exact message expected
- testing that the replacement of non-positive values is made when it should
If we go down the road of implementing satitize_pmf
then ideally the test is in a file test-satitize_pmf.R
.
add warning message sanitize_pmf Co-authored-by: Thibaut Jombart <[email protected]>
@CyGei - going through other open issues now, is this still relevant? |
Trying my first PR.
Issue: when w_dens contains 0s (not necessarily trailing 0s), the arbritary threshold 1e-15 can lead to some errors.
Solution: replace any 0s with the minimum value in w_dens.
Test : see tests/test_w_dens.R.
Questions: should we use the same procedure for f_dens?
Should we use dexp() for the starting 0s ?
Why the dexp() tail sums to 1e-4?