Page 1 of 1

difftime function (possible Feature Request)

Posted: Wed Oct 14, 2020 2:40 pm
by mherberg
I apologize if this has been asked before, but I could not find it in search.

Is there support for base time functions or R dates (DateTimeClasses)? It appears not but I wanted to check. For example is there any easy way to calculate the interval between two columns like difftime function performs.

Thank you.

Re: difftime function (possible Feature Request)

Posted: Thu Oct 15, 2020 5:17 am
by jonathon
we don't have a date/time data type unfortunately.

a workaround is to express dates with an integer expressing the number of days since a particular date. then you can just subtract them.

jonathon

Re: difftime function (possible Feature Request)

Posted: Wed Oct 21, 2020 11:58 am
by eugenereed
Hi,

Is it possible to add a feature like difftime function in the future? As jonathon stated, a solution can be achieved in a way, but I believe that adding this feature will be a great convenience.

Re: difftime function (possible Feature Request)

Posted: Thu Oct 22, 2020 2:07 am
by jonathon
hi eugene,

it's definitely on the todo list. however adding a new data type is not a small task.

cheers

jonathon

Re: difftime function (possible Feature Request)

Posted: Thu Oct 22, 2020 7:53 am
by sbalci
I tried to add time difference using lubridate::interval() into jsurvival module.
It is very strict. Does not accept if format is not specified correctly.
Why do you want to calculate time interval? I would like to learn use case, and add if it is related to jsurvival module.