toxplot | R Documentation |
Draw a toxicity summary plot.
toxplot(
ftable,
total,
digits = 0L,
headers = NULL,
xlim = NULL,
order = c("none", "decreasing", "increasing"),
label.bars = c("n", "percent", "none"),
col.bars = NULL,
digits.bars = digits,
widths = c(1, 1, 2),
space = 1,
xaxis.at = NULL,
col.bg = "grey",
alpha.bg = c(0.25, 0.5),
legend = TRUE,
args.legend = list(),
...
)
ftable |
a two- or three-dimensional |
total |
total number of patients (for percentages) |
digits |
number of places past the decimal to keep for percentages |
headers |
a vector of labels for text column headers |
xlim |
the x-axis limits for the bar plot |
order |
optional ordering for the rows, one of |
label.bars |
optional text on each bar, one of |
col.bars |
a vector of colors for each column of |
digits.bars |
number of places past the decimal to keep for
|
widths |
the relative width of each column |
space |
additional space between final text column and bar plot |
xaxis.at |
x-axis tick positions |
col.bg, alpha.bg |
background color for text columns with alternating
|
legend |
logical; if |
args.legend |
an optional named list of arguments passed to
|
... |
additional graphical parameters passed to |
## example from rawr::tabler_by
set.seed(1)
f <- function(x, ...) sample(x, 100, replace = TRUE, ...)
tox <- data.frame(
id = rep(1:10, 10), phase = 1:2,
code = f(rawr::ctcae_v4$tox_code[1:100]),
grade = f(1:3, prob = c(.6, .3, .1)),
stringsAsFactors = FALSE
)
tox <- cbind(tox, rawr::match_ctc(tox$code)[, c('tox_cat', 'tox_desc')])
t1 <- ftable(
Category = tox$tox_cat,
Description = tox$tox_desc,
Grade = tox$grade
)
t2 <- ftable(
Description = tox$tox_desc,
Grade = tox$grade
)
n <- 25
## basic usage
toxplot(t1, n) ## three column
toxplot(t2, n) ## two column
toxplot(
t2, n, widths = c(1, 3), label.bars = 'percent',
headers = c('Toxicity description', 'N (%)'),
order = 'dec', xlim = c(0, 10), xaxis.at = c(0, 5, 10),
args.legend = list(x = 'bottomright', horiz = FALSE, cex = 2)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.