Skip to contents

Convert object to a competing risks task (TaskCompRisks).

Usage

as_task_cmprsk(x, ...)

# S3 method for class 'TaskCompRisks'
as_task_cmprsk(x, clone = FALSE, ...)

# S3 method for class 'data.frame'
as_task_cmprsk(
  x,
  time = "time",
  event = "event",
  id = deparse1(substitute(x)),
  cause_names = NULL,
  ...
)

# S3 method for class 'DataBackend'
as_task_cmprsk(
  x,
  time = "time",
  event = "event",
  id = deparse1(substitute(x)),
  cause_names = NULL,
  ...
)

Arguments

x

(any)
Object to convert, e.g. a data.frame().

...

(any)
Additional arguments.

clone

(logical(1))
If TRUE, ensures that the returned object is not the same as the input x.

time

(character(1))
Name of the column for outcome time. Times must be non-negative, finite numbers without missing values.

event

(character(1))
Name of column that holds the event indicator. \(0\) corresponds to censoring, values \(> 0\) correspond to different competing events (or causes).

id

(character(1))
Id for the new task. Defaults to the (deparsed and substituted) name of x.

cause_names

(character()|NULL)
Unnamed character vector of unique, nonempty descriptive names, ordered by cause code. If NULL, defaults to "Cause 1", "Cause 2", ..., "Cause K".

Value

TaskCompRisks.