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

find_start_date() not working as intended #37

Open
jpolonsky opened this issue Apr 21, 2023 · 1 comment
Open

find_start_date() not working as intended #37

jpolonsky opened this issue Apr 21, 2023 · 1 comment

Comments

@jpolonsky
Copy link

The idea of the find_start_date() and find_end_date() functions is excellent, and I find that the latter works exactly as intended. A really nice and useful function. However, I think there is an issue with find_start_date().

When trying to find the appropriate start date, you want the later of recall_begin, date_join, and date_born, not the earlier. As it is currently implemented, it always returns the beginning of the recall period, even if someone joins or is born during the recall period. It works as intended for end dates, though, as you want the earlier date, not the later.

@aspina7
Copy link
Member

aspina7 commented Apr 23, 2023

hey jonny - thanks for this. See what you are saying but its hard to code value judgements... e.g. if both date_join and date_born exist then which do you choose? Really that is a data quality checks question that should happen before passing vars to the function.
I think the best solution is to leave as is, i.e. returning the earliest of the variables given. However you do not to pass recall_begin to the function, this way if neither of the others exist it returns NA and then you can replace NA with recall_begin with a simple ifelse().
I guess we could make recall_begin a separate param and then hardcode the above...

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

No branches or pull requests

2 participants