Prepare data for Dot and Forest plots

pre_proc(data, typeval, cod)

prepare_dot_forest_plot_data(
  data,
  drug,
  benefit,
  risk,
  filters,
  category,
  type_graph,
  type_risk,
  ci_method = c("Supplied", "Calculated"),
  space_btwn_out_yn = "Y"
)

Arguments

data

(data.frame) dataset.

typeval

(character) Benefit or Risk

cod

(character) identifier either c - continuous or b for binary

drug

(character) selected drug.

benefit

(character) selected benefit.

risk

(character) selected risk.

filters

(character) selected filter.

category

(character) selected category.

type_graph

(character) selected way to display binary outcomes (absolute risk, relative risk, odds ratio).

type_risk

(character) selected way to display risk outcomes (crude proportions, exposure-adjusted rates per 100 PYs

ci_method

(character) confidence interval method, either Supplied (taken from the effect table) or Calculated (calculated within the program).

space_btwn_out_yn

(character) control spacing between outcomes

Functions

  • pre_proc(): adds a variable in dataframe which identifies whether the dataframe is for Benefit or Risk analysis.

Examples

dot_plot_src <- subset(effects_table, !is.na(Prop1))
bdin <- subset(dot_plot_src, Factor == "Benefit")
rdin <- subset(dot_plot_src, Factor == "Risk")

fplot_data <- prepare_dot_forest_plot_data(
  data = dot_plot_src,
  drug = unique(dot_plot_src$Trt1),
  benefit = unique(bdin$Outcome),
  risk = unique(rdin$Outcome),
  filters = "None",
  category = "All",
  type_graph = "Absolute risk",
  type_risk = "Crude proportions",
  ci_method = "Calculated",
  space_btwn_out_yn = "N"
)
#> [2024-08-28 08:20:52] > Prepare Dot plot data for binary outcomes
#> [2024-08-28 08:20:52] > trigger analysis based on type
#> [2024-08-28 08:20:52] >
#> absolute risk CI for binary outcomes is calculated and saved
#> [2024-08-28 08:20:52] > Prepare Forest plot data for absolute risk
#> [2024-08-28 08:20:52] > Prepare Dot plot data for binary outcomes
#> [2024-08-28 08:20:52] > trigger analysis based on type
#> [2024-08-28 08:20:52] >
#> absolute risk CI for binary outcomes is calculated and saved
#> [2024-08-28 08:20:52] > Prepare Forest plot data for absolute risk
#> [2024-08-28 08:20:52] > Dataout object from the create_order_label_der function is created
#> [2024-08-28 08:20:52] > Prepare data for Dot and Forest plots