Conversion of time variables is missing
Opened this issue · 7 comments
With option dates = TRUE
secuTrialR converts date and datetime variables. However, there is no conversion of time variables implemented. A user however might incorrectly assume that times are converted as well.
This missing conversion should be enabled. Either implicitly with dates = TRUE
or explicitly with a new option times = TRUE
Backward compatibility will be an issue here! Introducing this will break any user's code for manual time conversion.
it is already implemented... see e.g.
secuTrialR/R/dates_secuTrial.R
Line 71 in f0034ed
I wonder if something broke... one of the bad things with not updating the test databases/exports perhaps... we dont take into account potential changes in the exports (especially the metadata)...
I have a secutrial project to analyse at the moment... I'll see if it has any time variables in it....
Yes, but time variables never make it that far, since only date and datetime itemtypes are included in the dictionary used for conversion:
Lines 209 to 210 in f0034ed
Another complication is that there are three different formats in which times are exported, depending on the itemtype ("%H%M", "%H%M%S", and "%M%S") and leading 0 are trimmed. So unlike
secuTrialR/R/read_export_options.R
Lines 209 to 212 in f0034ed
we can not define a global time_format and rather have to parse the format in itqu
.
I can implement this later in summer, right now I have to finish another urgent project.
Backward compatibility will be an issue here! Introducing this will break any user's code for manual time conversion.
I realised, since the converted variable will have a ".date" (or ".time") in the variable name, this is not a problem.
I was thinking about this... as far as I'm aware, R does not have a native "time" variable type. POSIX requires a date element too... so the question is then, how do you represent time-only variables in R?
I was thinking about this... as far as I'm aware, R does not have a native "time" variable type. POSIX requires a date element too... so the question is then, how do you represent time-only variables in R?
There is a new member to the "tidyverse" that works well with lubridate
and could convert the secuTrial times to R objects: https://hms.tidyverse.org/reference/hms.html
(But I currently don't have time to implement this, unfortunately)
it's not even that new (2017)... I've never had need to do anything with such data though... but, yes, in principle, that could work I guess...