forester | R Documentation |
Creates a forest plot overlaid on a table.
forester(
left_side_data,
estimate,
ci_low,
ci_high,
ci_sep = " to ",
right_side_data = NULL,
estimate_precision = 1,
ggplot_width = 30,
null_line_at = 0,
file_path = file.path(tempdir(), paste0("forester_plot.", render_as)),
dpi = 600,
display = TRUE,
font_family = "mono",
estimate_col_name = "Estimate",
stripe_colour = "#eff3f2",
background_colour = "white",
x_scale_linear = TRUE,
xlim = NULL,
xbreaks = NULL,
nudge_y = 0,
nudge_x = 1,
nudge_height = 0,
nudge_width = 0,
justify = 0,
arrows = FALSE,
arrow_labels = c("Lower", "Higher"),
add_plot = NULL,
add_plot_width = 1,
add_plot_gap = FALSE,
point_sizes = 3,
point_shapes = 16,
center_ggplot = NULL,
lower_header_row = FALSE,
render_as = "png"
)
left_side_data |
Data frame (required). The information to be displayed to the left of the forest plot. |
estimate |
Vector. The point estimates to be displayed in the forest plot. |
ci_low |
Vector. The lower confidence bounds. |
ci_high |
Vector. The upper confidence bounds. |
ci_sep |
String. What should separate the low and high confidence bounds? Default " to ". |
right_side_data |
Data frame (optional). Information to be displayed on the right side of the table. If not supplied, an Estimate column is generated automatically. |
estimate_precision |
Integer. The number of decimal places on the estimate (default 1) |
ggplot_width |
Integer. The width of forest plot in characters (default 30) |
null_line_at |
Numeric. Default 0. Change to 1 if using relative measures such as OR, RR. |
file_path |
String. Where to save the image, default file.path(tempdir(), "forester_plot.png"). |
dpi |
Numeric. The image resolution in dpi, default 600 |
display |
Logical. Should the file be opened? Default TRUE. |
font_family |
String. The font to use for the ggplot and table. Default "mono". |
estimate_col_name |
String. The name for the generated estimate column. Default "Estimate" |
stripe_colour |
Hex String. Colour to use for the table stripes, default "#eff3f2". |
background_colour |
Hex String or Colour Name. The colour of the background, default "white". |
x_scale_linear |
Logical. Default TRUE, change to FALSE for a log scale. |
xlim |
Vector. Manually specify limits for the x axis as a vector length 2, i.e. c(low, high) |
xbreaks |
Vector. X axis breaks to label. Specify limits in xlim if using this option. |
nudge_y |
Numeric. Allows small changes to the vertical alignment of the forest plot points. 1 unit is approximately the height of 1 row. |
nudge_x |
Numeric. Nudge the alignment horizontally. Default 1. Higher values make the entire plot wider and consequently space out the elements of the figure. |
nudge_height |
Numeric. Adjust the overall height of the plot output. Default is 0. |
nudge_width |
Numeric. Adjust the overall width of the plot output. Default is 0. |
justify |
Numeric Vector. This should be a numeric vector either of length 1 (in which case it will apply to all columns) or of length equal to the number of columns in left_side_data + 1 (for the estimate column). Each number in the vector dictates the column justification, with 0 being left, 0.5 being center, and 1 being right. |
arrows |
Logical. Should there be arrows displayed below the ggplot? Default FALSE. Specify xlim if using arrows. |
arrow_labels |
String Vector, length 2. Labels for the arrows. Set arrows to TRUE or this will have no effect. |
add_plot |
A ggplot object to add to the right side of the table. To align correctly with rows, 1 unit is the height of a row and y = 0 for the center of the bottom row. |
add_plot_width |
Numeric. Width to display add_plot. Relative to the width of the forest plot, where 1 (the default) is the same width. |
add_plot_gap |
Logical. Should there be space added between the plot and the main figure? Default FALSE. |
point_sizes |
Vector. Length should be equal to 1 or nrow(left_side_data). The sizes of the points in the center plot, where 3.25 is the default. |
point_shapes |
Vector. Length should be equal to 1 or nrow(left_side_data). The shapes of the points in the center plot, where 16 (a filled circle) is the default. |
center_ggplot |
A ggplot object to use instead of the central plot. |
lower_header_row |
Logical. If TRUE, drops the header down one row (In the table rather than above it, like the default value (FALSE)) |
render_as |
String or Function. What output format should be used? Option is passed to ggplot2::ggsave() as the argument "device". Either pass a device function (e.g. png) or one of "eps", "ps", "tex" (pictex), "pdf", "jpeg", "tiff", "png", "bmp", "svg" or "wmf" (windows only). |
image
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.