Skip to contents

Helper function for creating censoring columns as factors.

Usage

BinaryToCensoring(is.censored, is.uncensored)

Arguments

is.censored

binary vector: 0=uncensored, 1=censored

is.uncensored

binary vector: 0=censored, 1=uncensored

Value

an object of class "factor" with levels "censored" and "uncensored"

Details

Exactly one of is.censored and is.uncensored must be specified as a named argument. All elements of the input vector must be 0, 1, or NA

See also

Author

Joshua Schwab jschwab77@berkeley.edu

Examples


 BinaryToCensoring(is.censored=c(0, 1, 1, 0, NA))
#> [1] uncensored censored   censored   uncensored <NA>      
#> Levels: censored uncensored
 BinaryToCensoring(is.uncensored=c(1, 0, 0, 1, NA))   #the same
#> [1] uncensored censored   censored   uncensored <NA>      
#> Levels: censored uncensored
 
 if (FALSE) {
 BinaryToCensoring(c(0, 1))   #error because the input must be named
 }