Package 'triangulate'

Title: Useful functions for performing evidence triangulation
Description: What the package does (one paragraph).
Authors: Luke McGuinness [aut] (ORCID: <https://orcid.org/0000-0001-8730-9761>), Tassia Jones [aut], Chin Yang Shapland [aut, cre]
Maintainer: Chin Yang Shapland <[email protected]>
License: MIT + file LICENSE
Version: 0.0.2
Built: 2026-05-16 08:06:00 UTC
Source: https://github.com/mcguinlu/triangulate

Help Index


Beta-carotene RoB Judgments (Raw) Domain-level risk of bias judgments for 15 studies of beta-carotene and cardiovascular outcomes.

Description

Beta-carotene RoB Judgments (Raw) Domain-level risk of bias judgments for 15 studies of beta-carotene and cardiovascular outcomes.

Usage

beta_carotene_data

Format

A data frame with 27 rows and 25 variables.

Source

Supplement to Shapland et al. (2024)


Example risk of bias assessments

Description

Example risk of bias assessments

Usage

dat_bias

Format

A data frame with 20 rows and 26 variables


Example priors for the bias adjustment

Description

Example priors for the bias adjustment

Usage

dat_bias_values

Format

A data frame with 3 rows and 6 variables


Example indirectness assessments

Description

Example indirectness assessments

Usage

dat_ind

Format

A data frame with 20 rows and 14 variables


Example priors for indirectness adjustment

Description

Example priors for indirectness adjustment

Usage

dat_ind_values

Format

A data frame with 3 rows and 6 variables


Interactive bias-adjusted plot (horizontal layout)

Description

Launches a Shiny app that allows users to adjust additive and proportional bias priors and visualizes both original and adjusted estimates horizontally.

Usage

interactive_bias_plot(dat)

Arguments

dat

A data.frame with columns: result_id, yi, vi, study, type

Value

A Shiny app object


Convert to absolute direction of bias or indirectness

Description

Converts qualitative bias direction labels (e.g. "Favours comparator") into absolute directions ("left" or "right") based on effect size and bias type.

Usage

tri_absolute_direction(dat)

Arguments

dat

Data in long format


Convert absolute direction back to qualitative tool labels

Description

Reverses the transformation done by tri_absolute_direction(), converting absolute directions ("left"/"right") back to labels like "Favours comparator".

Usage

tri_absolute_direction_invert(dat)

Arguments

dat

Data in long format


Quick wrapper to apply absolute direction transformation

Description

Converts data between wide and long format while applying or reversing the absolute direction transformation.

Usage

tri_absolute_direction_quick(dat, invert = FALSE)

Arguments

dat

Dataset in wide format ## check this is the correct parameter

invert

If TRUE, reverse transformation (absolute → qualitative)


Append bias priors to bias dataset

Description

Joins the appropriate prior parameters to a long-format bias dataset, based on the risk-of-bias judgment (j), direction (d), and type (t).

Usage

tri_append_bias(dat, values = NULL, common = TRUE)

Arguments

dat

A bias dataset in long format (must include j, d, t, domain, result_id)

values

A data frame of prior distributions (e.g., from dat_bias_values)

common

Should a single set of prior distributions be used across all domains (default is TRUE)? Set to FALSE to allow domain-specific priors.

Value

Dataset with numeric bias prior values appended


Append indirectness priors to dataset

Description

Similar to tri_append_bias(), but operates on indirectness judgments and priors

Usage

tri_append_indirect(dat, values, common = TRUE)

Arguments

dat

A long-format indirectness dataset

values

A dataframe of indirectness priors (e.g., dat_ind_values)

common

Should a single set of distributions be used across all domains (default is TRUE)?

Value

Dataset with indirectness prior values appended


Calculate Bias-Adjusted Estimates

Description

Computes adjusted effect estimates (yi_adj) and variances (vi_adj) incorporating additive and proportional bias adjustments.

Usage

tri_calculate_adjusted_estimates(dat)

Arguments

dat

A dataset prepared using tri_prep_data(), containing bias parameters

Value

A tibble with added yi_adj and vi_adj columns


Check that required columns are present

Description

Validates whether key variables are present in the dataset. Can toggle between a basic ("minimal") check or a "full" check including columns needed for bias adjustment.

Usage

tri_dat_check(dat, mode = c("minimal", "full"))

Arguments

dat

A data frame (long or wide format)

mode

Check mode: either "minimal" or "full"

Value

Throws an error if required columns are missing. Otherwise returns TRUE (invisibly).


Plot bias-adjusted and unadjusted estimates with RoB

Description

Creates a forest plot of both raw and adjusted effect estimates, alongside domain-level risk of bias annotations for each study.

Usage

tri_plot_bias_direction(
  dat,
  dat_adj = NULL,
  title = NULL,
  grouping = "type",
  rma_method = "REML",
  ...
)

Arguments

dat

A dataframe output from tri_calculate_adjusted_estimates(), with yi, vi, yi_adj, vi_adj, and domain columns.

dat_adj

A data frame with adjusted estimates and variances, if different from the main input.

title

Optional plot title.

grouping

Column by which to stratify subgroups (default = "type").

rma_method

Meta-analysis method passed to metafor::rma (e.g., "REML", "FE"). We use metafor's default which random-effects

...

Additional arguments passed to rob_direction().

Value

A forest plot is drawn (base graphics).


Prepare bias and indirectness data for adjustment

Description

Aggregates domain-level prior data and calculates total adjustment values per study result. Supports additive and proportional adjustments.

Usage

tri_prep_data(dat_bias, dat_ind)

Arguments

dat_bias

Data with bias priors (long format)

dat_ind

Data with indirectness priors (long format)

Value

Data with yi/vi and adjustment components ready for adjustment


Standardise Effect Direction and Adjust Bias Directions

Description

Flips effect estimates (yi) and proportional bias directions (d) for specified study types (e.g., odds ratios) to ensure consistency across studies using different metrics.

Usage

tri_swap_effect_direction(dat, types = NULL)

Arguments

dat

A long-format triangulation dataset

types

A character vector of type values to flip (e.g. c("OR", "RR"))

Value

A modified dataset with adjusted yi and d values


Convert data from wide to long format

Description

Reshapes domain-level bias columns from wide format (e.g., d1j, d1t, d1d) to long format. Assumes columns follow naming pattern like d1j, d1t, d1d, d2j, etc.

Usage

tri_to_long(dat)

Arguments

dat

A data frame in wide format

Value

A long-format data frame with columns: domain, j, t, d


Convert data from long to wide format

Description

Reshapes domain-level bias columns from long format to wide format (e.g., d1j, d1t, d1d). Assumes long format with columns 'domain', 'j', 't', 'd'.

Usage

tri_to_wide(dat)

Arguments

dat

A long-format triangulate dataset

Value

A wide-format data frame