Dear all, I am using the function ‘unfold’ from the ‘RcmdrPlugin.survival’ to convert my time-varying covariates dataset from wide to long. I managed to have it working for my data.
However, the problem I have is that the observations after an event, won’t be dropped from the dataset. For example, see the dataframe below: the event occurs at 1.2 (event.time=1), but the 1.3 to 1.6 will remain in the dataset. I did not find in the 'unfold' function an option to drop them, but I was probably not looking well. >From the Rossi dataset example, I saw that observations following event were dropped, and I understood this might be because the values of the time-varying covariates are NA, after the event. In my case, all time-varying covariates still have values, even after the event, because they were extracted from a very large number of environmental raster files; so I guess the function ‘unfold’ sees them as observations being at risk again. Do you know/is there any way, to get rid of these remaining observations (1.3 to 1.6)? start stop event.time id_cell month rvf_bin lake month_rain month_veg 1.1 0 1 0 1 2 1 2.5 23 21 1.2 1 2 1 1 2 1 2.5 56 66 1.3 2 3 0 1 2 1 2.5 3 11 1.4 3 4 0 1 2 1 2.5 12 21 1.5 4 5 0 1 2 1 2.5 11 20 1.6 5 6 0 1 2 1 2.5 21 35 2.1 0 1 0 2 NA 0 2.5 12 22 Many thanks for your advice, Best regards, Rapha -- View this message in context: http://r.789695.n4.nabble.com/Function-unfold-package-RcmdrPlugin-survival-tp3630809p3630809.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.