1

I have a datset that looks something like this:

> head(BurnData)
  Treatment Gender Race Surface head buttock trunk up.leg low.leg resp.tract type ex.time excision antib.time antibiotic
1         0      0    0      15    0       0     1      1       0          0    2      12        0         12          0
2         0      0    1      20    0       0     1      0       0          0    4       9        0          9          0
3         0      0    1      15    0       0     0      1       1          0    2      13        0         13          0
4         0      0    0      20    1       0     1      0       0          0    2      11        1         29          0
5         0      0    1      70    1       1     1      1       0          0    2      28        1         31          0
6         0      0    1      20    1       0     1      0       0          0    4      11        0         11          0
  inf.time infection
1       12         0
2        9         0
3        7         1
4       29         0
5        4         1
6        8         1

I want to run a Cox's Regression on variables Surface, ex.time and, antib.time and treatment. Treatment is an indicator variable. Surface denotes the % of body burned. ex.time and antib.time both record time to event in days.

I am aware that to run a time dependent Cox's Regression i need to convert the data in longitudinal structure, but how can i do it in R?

then i will use the forluma:

coxph(formula = Surv(tstart, tstop, infection) ~ covariate)

DATA

> dput(head(BurnData))
structure(list(Treatment = c(0L, 0L, 0L, 0L, 0L, 0L), Gender = c(0L, 
0L, 0L, 0L, 0L, 0L), Race = c(0L, 1L, 1L, 0L, 1L, 1L), Surface = c(15L, 
20L, 15L, 20L, 70L, 20L), head = c(0L, 0L, 0L, 1L, 1L, 1L), buttock = c(0L, 
0L, 0L, 0L, 1L, 0L), trunk = c(1L, 1L, 0L, 1L, 1L, 1L), up.leg = c(1L, 
0L, 1L, 0L, 1L, 0L), low.leg = c(0L, 0L, 1L, 0L, 0L, 0L), resp.tract = c(0L, 
0L, 0L, 0L, 0L, 0L), type = c(2L, 4L, 2L, 2L, 2L, 4L), ex.time = c(12L, 
9L, 13L, 11L, 28L, 11L), excision = c(0L, 0L, 0L, 1L, 1L, 0L), 
    antib.time = c(12L, 9L, 13L, 29L, 31L, 11L), antibiotic = c(0L, 
    0L, 0L, 0L, 0L, 0L), inf.time = c(12L, 9L, 7L, 29L, 4L, 8L
    ), infection = c(0L, 0L, 1L, 0L, 1L, 1L), Surface_discr = structure(c(1L, 
    1L, 1L, 1L, 2L, 1L), .Label = c("1", "2"), class = "factor"), 
    ex.time_discr = c(1L, 1L, 1L, 1L, 2L, 1L), antib.time_discr = c(1L, 
    1L, 1L, 2L, 2L, 1L)), .Names = c("Treatment", "Gender", "Race", 
"Surface", "head", "buttock", "trunk", "up.leg", "low.leg", "resp.tract", 
"type", "ex.time", "excision", "antib.time", "antibiotic", "inf.time", 
"infection", "Surface_discr", "ex.time_discr", "antib.time_discr"
), row.names = c(NA, 6L), class = "data.frame")
user1607
  • 531
  • 7
  • 28
  • 1
    Please make sure to use **reproducible** data. Try `dput(head(BurnData))` (see the `r` tag description for more info). – Hack-R Jun 10 '18 at 16:19

0 Answers0