我有一个变量称为Started
人类受试者参加研究dos1
的日期,另一个变量称为受试者最后一次手术的日期。我想计算从他们最后一次手术到入学之日的几个月。我试过:
as.period(syrrupan$Started-syrrupan$dos1,units=c("month"))
我希望这会给我类似的东西:
14, 18, 1, 26
每个数字都是月数。
相反,我得到:
1 year, -4 months, -5 days and -1 hours 1 year, -5 months, -23 days and -1 hours 1 year, -7 months, 2 days and -1 hours 1 year, -8 months, -28 days and 1 hour 1 year, -7 months, -23 days and 1 hour.
我怎样才能得到月份的数值?