Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我尝试使用此命令创建一个生存对象。
Surv(date1, date2, event=status)
它导致错误“时间变量不是数字”。请注意,“date1”和“date2”的类是日期。
在创建生存对象之前,我是否需要将 Date 对象强制转换为数字?我认为这没有任何意义。
Time 变量必须是数字才能使生存函数起作用,或者在您的情况下,您可以执行以下操作: Surv(as.numeric(date2 - date1), event=status)
Surv(as.numeric(date2 - date1), event=status)