time varing cox model in R

I am currently researching the association between menopause and the incidence of diabetes, with menopause status as a time-varying exposure in my analysis. Menopause status is a binary variable, taking values 0 and 1. I have collected data at baseline and at three follow-up time points. I also have the examination dates for all participants, which allows me to calculate follow-up times. My question pertains to the data structure: should it be in long format, and if so, should I define the follow-up times before proceeding? In a long-format dataset for my study, I typically calculate and include the follow-up times as the time intervals between each observation. These intervals represent the time that has passed since the previous observation for each participant.I have problems with how i should preaper my data for the main analysis in R . I need your help and idea

Data should be in long format

glm(formula = CHD ~ AGE, family = binomial(link = "logit"), data = chdage)

is an example that illustrates why—CHD and AGE are variables, and variables are in columns.

Follow-up times are analogous to age. See this worked example showing the conversion of ages to cohorts.