<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div>I am trying to get an id variable into TSE data so I can match event data with other data that is indexed with this ID variable. I kept running into problems doing this, and after trying a number of things, I found that whether this works depends on the name that I use for this ID variable, which seems strange. So the following code works and correctly pulls the ID variable into the TSE data.<br></div><div><br></div><div>id <- c(10,20,30,40)<br>t1 <- c(1,1,1,1)<br>t2 <- c(1,2,NA,1)<br>t3 <- c(1,NA,2,1)<br>t4 <- c(2,2,2,2)<br>t5 <- c(1,1,2,2)<br>data <- data.frame(id,t1,t2,t3,t4,t5)<br><br>data.seq <- seqdef(data, 2:6, labels = c("NotDisabled","Disabled"),id=data$id)<br>transition2 <- seqetm(data.seq, method="transition")<br>data.tse <- seqformat(data, 2:6,
 from="STS", to = "TSE", tevent=transition2, id=data$id)</div><div><br></div><div>However, if I change the name of the ID variable, then I get the following error:</div><div><br></div><div>Error in `[.data.frame`(x, r, vars, drop = drop) : <br>  undefined columns selected</div><div><br></div><div>For instance, if I just change the name and run the code again with the new variable name, then I get the error (only for the seqformat command, the seqdef command works fine):</div><div><br></div><div>names(data)[1] <- "pid"<br>data.seq <- seqdef(data, 2:6, labels = c("NotDisabled","Disabled"),id=data$pid)<br>data.tse <- seqformat(data, 2:6, from="STS", to = "TSE", tevent=transition2, id=data$pid)</div><div><br></div><div>Am I missing some reason why the former name works but not the latter?</div></div></body></html>