I'm wanting to run a Kaplan-Meier analysis on survival data but my survival variables run from 0-7 and KM only uses 0s and 1s. I'll provide some background in case it's helpful. This is seedling survival data. I planted 7 acorns per subplot (there are 3 treatment habitats represented in this data) and recorded survival multiple times over a 2.5 year period. Variables are: time, survival and habitat, the data below is a dataset similar to what my real data looks like.
surva<-c(5,0,3, 2,0,0, 0,1,2, 3,0,1)
time<-c(1,2,3, 1,2,3, 1,2,3, 1,2,3)
habitat<-c("grassa", "grassb", "grassc", "grassa", "grassb", "grassc", "grassa", "grassb", "grassc", "grassa", "grassb", "grassc")
I want to turn my survival metrics into 1s (so they represent the seedlings that are alive in each habitat subplot) but I will also need to create duplicates of the corresponding cells (time and habitat) to go with the survival data. I appreciate any insight.
I think maybe this is helpful:
gives:
Is that the sort of thing you were after?