-
Notifications
You must be signed in to change notification settings - Fork 27
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
Unusual datetime classing #6
Comments
Reproduced this issue by creating a REDCap field
|
What is the expected class for a date? This is the default in R. |
I think https://github.com/vubiostat/redcapAPI/blob/main/R/fieldToVar.R#L62-L101 is the relevant code ( as written,
I'm going to guess If the user would prefer to customize the formats for their dates and/or times, they can set |
The field in question is a field type of |
@nutterb Please review main...BSTATGEN-1057-date-time-classes Also, why when this runs on CRAN do the test cases not execute? I thought they would reject test cases like this that fail without a file. |
These handlers seem like they will work. As I look at it, the only downside I can see is it doesn't permit any flexibility in how to apply the handlers. For instance, if you want to use a different time zone. But in fairness, the existing code doesn't do that either, so it isn't any different by default. The tests don't run on CRAN because of https://github.com/nutterb/redcapAPI/blob/master/.Rbuildignore#L10 (when the package is built, it omits the file that actually executes the tests) |
I did consider that one could have a handler for a specific field, not a redcap field type. I couldn't figure out an easy interface that would work for both. |
What if "handlers" applied to field type or field name? It could do very specific overrides. The only issue is the possibility of name collision, which is probably not that huge. I don't understand on the time zone difference, one can specify any function including user defined functions, thus it could account for any time zone in the function given to handlers. |
I think I would fall back on the idea of "do one thing and do it well" here. I'm not sure we provide an meaningful utility by giving users the ability to control how field type-level control, however, feels meaningful. Especially since I've locked you into Disclaimer of bias: I have strong opinions about analyzing date and date/time variables. Specifically, I have very rarely encountered cases where I would prefer a |
I doubt a lot of folks would use this feature. Let's keep it simple and do it well. |
I think the branch is ready to merge. |
Last pull request solved this. |
Got this email from a user:
Using the R REDCap API on a form I'm looking at the variables
hoendat
andhoentim
. I'm using the RdrinkREDCap
function fromrccola
.For
hoendat
I'm getting a variable of R classes labelled,POSIXct
, andPOSIXt
. I don't understand thePOSIXt
part and was expecting a pure date variable with no time to be of class Date.For
hoentim
I'm getting class labelled and times with an additional attribute 'format' with valueh:m:s
. But the variable values are fractions (I assume fraction of a day).I'd appreciate getting any further information about why these are set up this way. The most important thing to know is whether the same setup is used for all dates and times in the whole database, and that this is automatic without the user having an opportunity to introduce undesired variability in how dates and times are stored in the project database. I can deal with any format but need to have consistency.
The text was updated successfully, but these errors were encountered: