Commit b7c73bfa authored by levintow's avatar levintow
Browse files

updating wihs data with outcome and censoring variables

parent 166ebf40
......@@ -14,13 +14,18 @@ colnames(wihs)<-c("id","idu","white","age","cd4","drop","delta","art","time")
# Reviewing variables to make sure data read in correctly
str(wihs)
# construct a new dataset for input into
# Creating event time and censoring time variables for main analysis
wihs$Y <- ifelse(wihs$delta==1,wihs$time,NA) #Y is time of event (AIDS or death)
wihs$C <- ifelse(wihs$delta==0,wihs$time,NA) #C is time of censoring
wihs$C1 <- ifelse(wihs$drop==1,wihs$time,NA) #C1 is time of censoring due to drop-out
wihs$C2 <- ifelse(wihs$delta==0 & wihs$drop==0,wihs$time,NA) #C2 is time of censoring not due to drop-out
# Alan's code: Construct a new dataset looking at ART initiation
wihs2=wihs
wihs2$time=with(wihs,ifelse(art<time & !is.na(art),art,time))
wihs2$j=with(wihs,ifelse(art<time & !is.na(art),1,0))
wihs2$delta=with(wihs,ifelse(delta==1 | (!is.na(art) & art<time),1,0))
# Save R data set in the package
devtools::use_data(wihs,overwrite=TRUE)
devtools::use_data(wihs2,overwrite=TRUE)
No preview for this file type
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment