Have lubridate subtraction return only a numeric value

后端 未结 3 1942
有刺的猬
有刺的猬 2020-12-17 10:34

I have one variable called Started which is the date on which human subjects enrolled in a study and another variable called dos1 which is the date

3条回答
  •  醉梦人生
    2020-12-17 11:15

    You could try using difftime instead, ie:

    difftime(syrrupan$Started,syrrupan$dos1,units="days")
    

    Note that this will give you an object of class difftime, if you want a numeric vector, wrap an as.numeric around it. Note also that you can't choose months as an option for units, but you should really stick with a time unit that has a fixed length.

提交回复
热议问题