tx_icicle: Generate an icicle plot for treatment data.

Description Usage Arguments Value Examples

View source: R/tx_icicle.r

Description

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

Usage

1
2
3
tx_icicle(txvis, nsequ = NULL, seq.v.dat = "seq", start = NULL,
  end = NULL, interval = "month", conflict = "majority",
  tx_color = NULL)

Arguments

txvis

An object of class txvis.

nsequ

The number of sequences to be shown (default is 4)

seq.v.dat

Should the data be plotted by sequence order or by date?

start

If supplied the data will be truncated to all sequences after a start date.

end

If supplied the data will be truncated to all sequences before the end date.

interval

Length of time for intervening intervals for data plotted by date.

conflict

If two treatments fall within the same date interval, which should be displayed?

tx_color

A colorRampPalette to color the sequnces. Note that the first element of the color vector always codes to "None".

Value

A ggplot2 object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
 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)
                           
 # Basic plotting:                          
 tx_icicle(hlth_data)
 
 #  Add additional ggplot2 styline:
 tx_indiv(hlth_data) + ggplot2::theme_bw()
 
 # Use a customized color palette:
 library(RColorBrewer)
 colors <- c("#FFFFFF", brewer.pal(length(levels(hlth_data[[1]]$tx)), 'Accent'))
 tx_icicle(hlth_data, tx_color = colors)

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