insertLeftCensor: Adding rows with left-censored data points

View source: R/preprocessing.R

insertLeftCensorR Documentation

Adding rows with left-censored data points

Description

Depreciated, use censoringData. Creates extra rows for indicating left-censored data.

Usage

insertLeftCensor(
  dat,
  nestVars,
  timeVar,
  all.values = F,
  catVar,
  catName = "(left censored)"
)

Arguments

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 nestVars are possible.

timeVar

name of the column with the time variable. Only this variable will be copied if all.falues = FALSE.

all.values

boolean if all values of the first row should be copied or only the time information (timeVar)

catVar

name of the event (for coxph or frailty) or event-type (for multi-state) column where the indication of the left-censoring is stored.

catName

character or numeric value to be written in catVar

Value

data.frame with extra rows for left-censored data.

Examples

dat <- data.frame(ID = c(rep(1,10), rep(2,10)),
                 day = rep(c(rep(1,5), rep(2,5)),2),
                 a = runif(20, max = 10),
                 b = Sys.Date()+1:20,
                 cat = sample(c("X","Y","Z"), 20, replace = T))
insertLeftCensor(dat, nestVars = c("ID","day"), 
                timeVar = "b", catVar = "cat")


timonelmer/dena documentation built on April 15, 2023, 11:51 p.m.