-
Notifications
You must be signed in to change notification settings - Fork 48
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
define REDCap constants #217
Comments
I would define each constant separately. As long as they aren't exported, it won't create any issues for the user. For your own sanity, I'd recommend naming them with an underscore in front, just to give a visual cue that it is an internal constant. So |
@nutterb, I was thinking I would export them, so all my external code wouldn't have to define them. Do you think that's a bad idea? |
Not a bad idea at all. It just escaped me that you intended this for direct user access (I'm sleep deprived). I like how you have this set up currently, with I might add |
centrally define constants. Right now, I'm frequently re-defining these at the top of a lot of R files to avoid magic constants sprinkled throughout the code. There could be more than this, but currently I'd use
form_incomplete
=10form_unverified
=21form_complete
=32These values might be contained in a single list called
constant
, so the caller's code might look likeAlternatively, there could be a function called
constant()
, that accepts the name. The function would check to see if the constant is even defined, instead of returningNULL
. The caller's code might look likeAny opinions? If anyone has experience with this, or might have a better way, please tell me.
The text was updated successfully, but these errors were encountered: