-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tmerge #3
Comments
Hi,
or
|
Many thanks for the answer, however, it is necessary to use the tmerge to do the Cox proportional hazard ratio regression repeating measurement. id tstart tstop measurment status BUT, can't figure out how to do it with tmerge again!! |
I think you need to create an event before to merge datasets. data1<- data.frame(
id = c(1, 2, 3),
tstart = c(3, 2, 2),
tstop= c(4, 8, 6),
status = c(1, 0, 1),
measu1=c(54, 66, 18))
data2<- data.frame(
id = c(1, 2, 3),
tstart = c(3, 2, 2),
measu2=c(66, 73, 82))
data2 <- tmerge(data2, data2, id=id, endpt = event(tstart, measu2))
tmerge(data2, data1, id=id, tstop= tdc(endpt, tstop))
Error in tmerge(data2, data1, id = id, tstop = tdc(endpt, tstop)) : |
In the tmerge function, the tstart and tstop variables can be present in the first dataset only. |
I have a problem merging two data with repetitive measurements.
The merging did not include the second measurment.
library(survival)
data1<- data.frame(
subject = c(1, 2, 3),
time1 = c(3, 2, 2),
time2= c(4, 8, 6),
status = c(1, 0, 1),
First_measu=c(54, 66, 18))
data2<- data.frame(
subject = c(1, 2, 3),
Second_measu=c(66, 73, 82))
###Merge the data to do the coxph
merged_data<-tmerge(data1, data2, id=subject, tstart=time1, tstop=time2)
print(merged_data)
The text was updated successfully, but these errors were encountered: