Converts bulk survival data (multiple observations per row) to individual survival data (one observation per row)

get_indiv_surv(sample_data, sample_order = unique(sample_data$condition))

Arguments

sample_data

A data.frame object with 4 columns. Column headers must be ("condition", "day", "dead", "censored").

sample_order

character, conditions to plot, in order. Default: unique(sample_data$condition). To subset, use sample_order = c("WT", "Drug1")

Value

A tibble for lifespan by individual. Contains 3 columns: condition, day, status.

Details

Status: 1 = dead, 0 = censored.

Examples

# Default (alphabetical order)
df_isurv <- get_indiv_surv(sample_data)
#> Joining with `by = join_by(x, condition, day, sex, status)`

# Plot samples in a fixed order
df_isurv <- get_indiv_surv(sample_data,
                           sample_order = c("WT", "Drug1", "Drug2"))
#> Joining with `by = join_by(x, condition, day, sex, status)`

# Subset only 2 conditions
df_isurv <- get_indiv_surv(sample_data,
                           sample_order = c("WT", "Drug1"))
#> Joining with `by = join_by(x, condition, day, sex, status)`