# Time after time-dependent variable in Cox model

I am trying to create a time dependent (covariate) cox regression model for a survival analysis project I am interested in. A brief overview of my dataset:

I have a cohort starting from 2011-01-01, ending in 2016-12-31. The time dependent exposure is bereavement, all people start non-bereaved but eventually some will get exposed.

I have created the dataset using the survival package in R in which an individual who is going to be bereaved gives two rows in the data (one for the non-bereavement period and another for the bereavement period), while a non-bereaved during the follow up has only one row. I am interested in comparing mortality between bereaved and non-bereaved. I can do a survival analysis for that purpose, but I am also interested in seeing if the time since bereavement is also affecting mortality. However, I can't seem to do aforementioned, since I also have non-bereaved ones for which the time since bereavement cannot be computed. Do you happen to have any ideas how can I progress my analysis or happen to know any packages that are relevant to that purpose ? I have also check the following paper, and they seem to have managed something like that :

https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2465697/

Kind regards and thank you in advance for any potential ideas!

First, you could just analyze survival post bereavement separately, with the date of bereavement as time = 0 for that analysis. That would of course be restricted to those who experienced bereavement.
Second, you could add time since bereavement as a predictable time-dependent covariate, with time = 0 kept at your study start date. That value would always be 0 for those who didn't experience bereavement. Section 5 of the R time-dependence vignette shows how to do that with the time-transform feature of the R coxph() function.