Description Usage Arguments Value Examples
This function creates the data for and plots a forest plot comparing hazard rates for categorical variables by a 2 level by variable.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
data |
A dataset containing the necessary survival variables (event, time, other covariables). |
stat |
The event survival variable, numeric, with 1 coded as an event and 0 a censor. |
time |
The time survival variable, numeric. |
byvar |
The by variable with 2 distinct levels. |
covars |
A vector of categorical covariates that are desired for analysis. |
ref |
Reference by variable level (optional). Use this if specific by variable level is desired as the reference. |
labels |
An optional vector, soon to be list, of labels for the covariates in the 'covars' variable. Currently must be the same length as the 'covars' vector. |
graph.pos |
Column position for the graph. |
xaxis.breaks |
Distance between the x-axis breaks of the forest plot. |
title |
Title for the plot. |
x.lab |
Label for x-axis of plot. |
plot.include |
Logical to have plot return from function call. |
x.max |
Max value for x-axis. CI bands for intervals that pass this value will have an arrow on the right indicating a continuing band. |
... |
Additional arguments for the 'forestplot' function. |
This function returns a list of the forestplot produced and tables necessary to reproduce that plot.
1 2 3 4 5 6 7 8 9 | library(arsenal)
data(mockstudy)
mockstudy %>%
mutate(fu.stat = fu.stat - 1) %>%
filter(arm != "A: IFL" & age.ord != "10-19" & race != "Other") %>%
forest_plot(data = ., stat = "fu.stat", time = "fu.time", byvar = "arm",
covars = c("sex", "age.ord"), title = "Overall Survival",
labels = c("Gender", "Age Groups"),
xaxis.breaks = .5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.