View source: R/preprocessing.R
censoringData | R Documentation |
Creates extra rows for indicating left- or right-censored data.
censoringData(
dat,
nestVars,
timeVar,
eventVar = "event",
catVar = NULL,
TimeGap = 1,
censoring = "right",
verbose = T
)
dat |
data.frame containing the variables to be lagged |
nestVars |
name(s) of the columns indicating how the data is nested
(e.g., ID variable). Currently up to two |
timeVar |
name of the column with the time variable. |
eventVar |
name of the column indicating if an event (value = 1) happened or not/censored (0) |
catVar |
name of the event (for coxph or frailty) or event-type (for multi-state) column where the indication of the censoring is stored. |
censoring |
character string |
timeGap |
time to be added (for right-censoring) or removed (for left-censoring) form |
data.frame with extra rows for censored data.
dat <- data.frame(ID = c(rep(1,10), rep(2,10)),
day = rep(c(rep(1,5), rep(2,5)),2),
event = 1,
a = runif(20, max = 10),
t = rlnorm(20,1,.4),
cat = sample(c("X","Y","Z"), 20, replace = T))
censoringData(dat, nestVars = c("ID"), timeVar = "t")
censoringData(dat, nestVars = c("ID","day"), timeVar = "t")
censoringData(dat, nestVars = c("ID"), timeVar = "t", censoring = "left",TimeGap = 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.