-
Notifications
You must be signed in to change notification settings - Fork 25
Description
TADA_FlagBelowThreshold() [615-816] & TADA_FlagAboveThreshold() [408-611] are very similar, just with one comparing on < and the other >. Each function should do one thing well - but this seems like an opportunity to reduce duplicative code. The other thing that isn't clear to me is how to flag both - as when I flag one it drops the existing flag column.
'Flag' is also a bit of a misnomer being that the function will flag/filter/clean.
One option would be an arg with 3 acceptable params [Below/Above/Between]. Maybe shorten to TADA_Thresholds()? Not sure how R does with that since the boolean logic makes me think you have tried to avoid args like that?
Another option would be to add an internal function that does all the work and keep the current two as is, passing the internal function info specific to above/below, thus letting users interact with it the way it is (v1.0 suggests some stability).