show_forest | R Documentation |
This is a wrapper of function ezcox, get_models and show_models. It focus on generating forest plot easily and flexibly.
show_forest(
data,
covariates,
controls = NULL,
time = "time",
status = "status",
merge_models = FALSE,
model_names = NULL,
vars_to_show = NULL,
drop_controls = FALSE,
add_caption = TRUE,
point_size = 3,
point_shape = 15,
color = "red",
banded = TRUE,
headings = list(variable = "Variable", n = "N", measure = "Hazard ratio", ci = NULL, p
= "p"),
model_dir = file.path(tempdir(), "ezcox"),
verbose = TRUE,
...
)
data |
a |
covariates |
a character vector optionally listing the variables to include in the plot (defaults to all variables). |
controls |
column names specifying controls.
The names with pattern "*:|()" will be treated as interaction/combination
term, please make sure all column names in |
time |
column name specifying time, default is 'time'. |
status |
column name specifying event status, default is 'status'. |
merge_models |
if 'TRUE', merge all models and keep the plot tight. |
model_names |
model names to show when |
vars_to_show |
default is |
drop_controls |
works when |
add_caption |
if |
point_size |
size of point. |
point_shape |
shape value of point. |
color |
color for point and segment. |
banded |
if |
headings |
a |
model_dir |
a path for storing model results. |
verbose |
if |
... |
other arguments passing to |
a ggplot
object
library(survival)
show_forest(lung, covariates = c("sex", "ph.ecog"), controls = "age")
show_forest(lung, covariates = c("sex", "ph.ecog"), controls = "age", merge_models = TRUE)
show_forest(lung,
covariates = c("sex", "ph.ecog"), controls = "age", merge_models = TRUE,
drop_controls = TRUE
)
p <- show_forest(lung,
covariates = c("sex", "ph.ecog"), controls = "age", merge_models = TRUE,
vars_to_show = "sex"
)
p
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.