Converts dates and datetime variables to Date
or POSIXct
class, as appropriate.
dates_secuTrial(object, ...)
# S3 method for secuTrialdata
dates_secuTrial(object, ...)
secuTrialdata
object
further parameters
same as the original object with date variables converted to Date
s.
New variables are created appended with .date
or .datetime
.
This is a safety mechanism in case NAs are inadvertently introduced.
# prepare path to example export
export_location <- system.file("extdata", "sT_exports", "lnames",
"s_export_CSV-xls_CTU05_long_ref_miss_en_utf8.zip",
package = "secuTrialR")
# load all export data
sT_export <- read_secuTrial_raw(data_dir = export_location)
# prepare dates
sT_export_dates <- dates_secuTrial(sT_export)
# show parsed datetime example
sT_export_dates$ctu05baseline$hiv_date.datetime[1]
#> [1] "2019-03-05 23:56:00 UTC"
# [1] "2019-03-05 23:56:00 CET"
# show parsed date example
sT_export_dates$ctu05baseline$paracetamol_start.date[1]
#> [1] "2019-03-05"
# [1] "2019-03-05"