pss_draw_consort: Draw the consort diagram for PSS

View source: R/pss_draw_consort.R

pss_draw_consortR Documentation

Draw the consort diagram for PSS

Description

Draw the consort diagram for PSS

Usage

pss_draw_consort(
  num_main_boxes = 5,
  height_main_box = 10,
  main_box_annotations = c(""),
  right_side_box_locations = c(""),
  right_side_box_height = 10,
  right_side_box_annotations = c(""),
  font_size = 2.5,
  left_side_box_locations = c(""),
  left_side_box_height = 10,
  left_side_box_annotations = c(""),
  title = "",
  title_color = "black",
  title_size = 7,
  subtitle = "",
  subtitle_color = "black",
  subtitle_size = 5
)

Arguments

num_main_boxes

Number of boxes down the middle

height_main_box

Height of each main box

main_box_annotations

Character vector for each annotation for the middle boxes.

right_side_box_locations

Character vector with box numbers for where right side boxes should be located.

right_side_box_height

Height of each right box.

right_side_box_annotations

Character vector for each annotation for the right boxes.

font_size

Font size

left_side_box_locations

Character vector with box numbers for where left side boxes should be located.

left_side_box_height

Height of each left box.

left_side_box_annotations

Character vector for each annotation for the left boxes.

title

Title of diagram

title_color

Title color

title_size

Title size

subtitle

Subtitle of diagram

subtitle_color

Subtitle color

subtitle_size

Subtitle size

Examples

num_assessed <- sum(tmp_completed_forms$total_records)
num_consented <- sum(tmp_completed_forms$consent)
num_excluded <- 0
num_ineligible <- 0
num_refused_consent <- 0
num_baseline <- sum(tmp_completed_forms$baseline)
num_baseline_idi <- sum(tmp_completed_forms$baseline_idi)
num_baseline_idi_child <- sum(tmp_completed_forms$baseline_idi_child)
num_followup_idi <- 0
num_followup_idi_child <- 0
num_baseline_wdrn <- 0
num_baseline_ltfu <- 0
num_wave2 <- sum(tmp_completed_forms$wave2)
num_wave3 <- sum(tmp_completed_forms$wave3)
num_wave4 <- sum(tmp_completed_forms$wave4)

annotations_center <- c(paste0(num_assessed, " participants have initial contact forms"),
                        paste0(num_consented, " participants consented"),
                        paste0(num_baseline, " participants completed baseline"),
                        paste0(num_wave2, " participants completed wave 2"),
                        paste0(num_wave3, " participants completed wave 3"))
annotations_left <- c(paste0(num_baseline_idi, " baseline idis\n", num_baseline_idi_child, " child baseline idis"),
                      paste0(num_followup_idi, " follow-up idis\n", num_followup_idi_child, " child follow-up idis"))
annotations_right <- c(paste0(num_ineligible, " participants ineligible\n", num_refused_consent, " refused consent"),
                       paste0(num_baseline_wdrn, " participants withdrawn\n", num_baseline_ltfu, " participants LTFU"),
                       paste0(num_baseline_wdrn, " participants withdrawn\n", num_baseline_ltfu, " participants LTFU"),
                       paste0(num_baseline_wdrn, " participants withdrawn\n", num_baseline_ltfu, " participants LTFU"))

consort <- draw_consort(num_main_boxes = 5,
                        height_main_box = 10,
                        main_box_annotations = annotations_center,
                        right_side_box_locations = c("1,2", "2,3", "3,4", "4,5"),
                        right_side_box_height = 10,
                        right_side_box_annotations = annotations_right,
                        font_size = 3,
                        left_side_box_locations = c("3,4", "4,5"),
                        left_side_box_height = 10,
                        left_side_box_annotations = annotations_left,
                        title = "Project Safeschools", title_color = safeschools_colors[1], title_size = 4,
                        subtitle = paste0(site_name,"\n",format(Sys.Date(), '%B %d, %Y')), subtitle_color = safeschools_colors[2], subtitle_size = 3.5)

consort

prebman1/pssTools documentation built on May 16, 2022, 7:55 a.m.