tx_indiv: Generate an icicle plot for treatment data.

Description Usage Arguments Value Examples

View source: R/tx_indiv.r

Description

Using a txvis object, plot the sequencing of treatments using an icicle plot.

Usage

1
2
tx_indiv(txvis, nsample = NULL, aligned = FALSE, clustered = FALSE,
  events = FALSE)

Arguments

txvis

An object of class txvis.

nsample

The number of patients to show sequence data for. Default is 10.

aligned

Should treatment sequences be displayed by date, or from a common origin. Default is FALSE.

clustered

Organize treatments so that similar treatments are adjacent to one another. Not implemented.

events

Should individual events be superimposed onto the treatment sequences. Defaults to FALSE.

Value

Returns a ggplot2 object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 hlth_data <- create_txvis(patient        = treat$pat_id, 
                           treatment      = treat$treatment,
                           start          = treat$start,
                           end            = treat$end,
                           date_format    = "%d%b%Y",
                           ev_patient     = events$pat_id,
                           events         = events$event,
                           event_date     = events$start,
                           event_end_date = events$end)
                           
 # Plot without events:                          
 tx_indiv(hlth_data)
 
 # Plot with event data:
 tx_indiv(hlth_data, events = TRUE)
 
 #  Add additional ggplot2 styline:
 library(ggplot2)
 
 tx_indiv(hlth_data) + theme_bw()
 
 # Show many more samples & events, and assign a common start date.
 tx_indiv(hlth_data, nsample = 50, aligned = TRUE) +
   theme(axis.text.y = element_text(size = 8))
 

johnwilsonICON/TxVis documentation built on May 19, 2019, 5:18 p.m.