Description Usage Arguments Details Value See Also Examples
Applies textToDate
in the CALIBERcodelists package
repeatedly to convert each relevant column from
character to IDate (integer date).
1 | convertDates(data, datecolnames = NULL, verbose = TRUE)
|
data |
data.table which contains the columns to be converted. |
datecolnames |
optional vector of names of date columns. If some of these columns are not in data, they are ignored. |
verbose |
whether to print a message stating which columns were converted. |
If date conversion is unsuccessful, the column is left in its original form (character or factor).
The modified data.table or ffdf. If data
is a data.table, it is also updated by reference.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Create a cohort for testing
mydata <- data.table(anonpatid=1:3,
indexdate=c('2010-01-01', '2009-03-05', '2008-05-06'),
deathdate=c(NA, '', '2009-09-08'))
# Convert dates in ffdf
myffdf <- as.ffdf(mydata)
myffdf <- convertDates(myffdf)
print(myffdf)
# Convert dates in data.table
# (updated by reference so no assignment is needed)
convertDates(mydata) # is the same as mydata <- convertDates(mydata)
print(mydata)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.