order_swimlane: Order a tibble for swimlane plotting

View source: R/order_swimlane.R

order_swimlaneR Documentation

Order a tibble for swimlane plotting

Description

Assigns factor levels to an identifying key in a tibble (often subject ID) by a second variable (often study duration), with the option to perform this sorting within groups. Most often used before a call to ggplot() + geom_swimlane()

Usage

order_swimlane(.data, id_var, order_by, order_within = NULL)

Arguments

.data

A tibble or data.frame

id_var

Row (often subject) ID

order_by

Variable to sort by, often time on study

order_within

Variable to sort within, often cohort

Value

A tibble with id_var as a releveled factor

Examples

patient_disposition %>%
  order_swimlane(subject, weeks_on_study, cohort)

tgerke/ggswimlane documentation built on Aug. 8, 2022, 12:29 p.m.