Rev 104 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
# We purposely omit the first obs, who has no events and 0 fu time.#unix("tail +14 data.bladder | sed -e 's/$/ NA NA NA NA/' > xxx")temp <- scan("xxx", what=list(rx=0, futime=0, size=0, number=0,r1=0, r2=0, r3=0, r4=0), flush=T)n <- length(temp$rx)id <- 1:nrr <- c(temp$r1, temp$r2, temp$r3, temp$r4)who <- !is.na(rr)bladder <- data.frame(id= c(rep(id,4)[who], id),rx= c(rep(temp$rx,4)[who], temp$rx),size=c(rep(temp$size,4)[who], temp$size),number=c(rep(temp$number,4)[who], temp$number),stop =c(rr[who], temp$futime),event=c((rr/rr)[who], rep(0,n)) )nn <- length(bladder$id)bladder <- bladder[order(bladder$id, bladder$stop),]bladder$start <- ifelse(diff(c(0,bladder$id))!=0, 0,c(0, bladder$stop)[1:nn])# The bladder data now has some rows in it that are extraneous, i.e.,# start=stop. We'll eliminate them by and by. But first, form the# WLW analysis data setbladder.wlw <- data.framebladder$stop <- bladder$stop + .01*(bladder$start==bladder$stop) #a hackrow.names(bladder) <- 1:nn## Create the index variables: bl.1 = obs numbers for a 'first recurrence' runid <- bladder$idbl.1 <- (1:nn)[diff(c(0,id))!=0]bl.2 <- bl.1 + 1*(id[bl.1]== c(id,0)[bl.1+1])bl.3 <- bl.2 + 1*(id[bl.2]== c(id,0)[bl.2+1])bl.4 <- bl.3 + 1*(id[bl.3]== c(id,0)[bl.3+1])fail1 <- rep(F,nn); fail1[bl.1]<- Tfail2 <- rep(F,nn); fail2[bl.2]<- Tfail3 <- rep(F,nn); fail3[bl.3]<- Tfail4 <- rep(F,nn); fail4[bl.4]<- Trm(temp, n, id, rr, nn, who)