Learn R Programming

flowchart (version 0.7.0)

fc_draw: fc_draw

Description

This function allows to draw the flowchart from a fc object.

Usage

fc_draw(
  object,
  box_corners = "round",
  arrow_angle = 30,
  arrow_length = grid::unit(0.1, "inches"),
  arrow_ends = "last",
  arrow_type = "closed",
  title = NULL,
  title_x = 0.5,
  title_y = 0.9,
  title_color = "black",
  title_fs = 15,
  title_fface = 2,
  title_ffamily = NULL
)

Value

Invisibly returns the same object that has been given to the function, with the given arguments to draw the flowchart stored in the attributes.

Arguments

object

fc object that we want to draw.

box_corners

Indicator of whether to draw boxes with round (`"round"`) vs non-round (`"sharp"`) corners. Default is `"round"`.

arrow_angle

The angle of the arrow head in degrees, as in `arrow`.

arrow_length

A unit specifying the length of the arrow head (from tip to base), as in `arrow`.

arrow_ends

One of "last", "first", or "both", indicating which ends of the line to draw arrow heads, as in `arrow`.

arrow_type

One of "open" or "closed" indicating whether the arrow head should be a closed triangle, as in `arrow`.

title

The title of the flowchart. Default is NULL (no title).

title_x

x coordinate for the title. Default is 0.5.

title_y

y coordinate for the title. Default is 0.9.

title_color

Color of the title. It is black by default. See the `col` parameter for gpar.

title_fs

Font size of the title. It is 15 by default. See the `fontsize` parameter for gpar.

title_fface

Font face of the title. It is 2 by default. See the `fontface` parameter for gpar.

title_ffamily

Changes the font family of the title. Default is NA. See the `fontfamily` parameter for gpar.

Examples

Run this code
safo |>
  as_fc(label = "Patients assessed for eligibility") |>
  fc_filter(!is.na(group), label = "Randomized", show_exc = TRUE) |>
  fc_split(group) |>
  fc_filter(itt == "Yes", label = "Included in ITT") |>
  fc_filter(pp == "Yes", label = "Included in PP") |>
  fc_draw()

Run the code above in your browser using DataLab