Have lubridate subtraction return only a numeric value
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.
That's definitely a bug in lubridate. I've made an error report and will fix it for version 0.1:
http://github.com/hadley/lubridate/issues#issue/75
Thanks for bringing it to my attention.
As noted in R - lubridate - Convert Period into numeric counting months the intended lubridate method here would be time_length
time_length(syrrupan$Started-syrrupan$dos1, unit="days")