Skip to contents

Shipped interactmeta datasets are already long (one row per trial × subgroup). If your source tables are wide (one row per trial, columns suffixed by subgroup such as yi_Younger or n_IV), use this helper before cams() or escalc(). Metadata on wide tables (subgroups, subgroup_id_cols, subgroup_value_cols) drives the reshape; you can override those arguments when needed.

Usage

subgroup_long(data, subgroups = NULL, id_cols = NULL, values = NULL)

Arguments

data

A wide data frame, or an already long data frame (returned as-is).

subgroups

Modifier labels in column-suffix order (default: dataset attribute).

id_cols

Trial-level columns repeated on each row (default: attribute).

values

Column stems to expand (default: attribute).

Value

A long data frame with subgroup and the value columns.

Examples

# Shipped `steroids` is already long; `subgroup_long()` is for wide source tables.
long_steroids <- subgroup_long(steroids)
head(long_steroids[, c("study", "subgroup", "n", "treat.events")])
#> # A tibble: 6 × 4
#>   study         subgroup     n treat.events
#>   <chr>         <chr>    <int>        <int>
#> 1 CAPE COVID    NIV         28            1
#> 2 CAPE COVID    IV         120           10
#> 3 CoDEX         NIV          0            0
#> 4 CoDEX         IV         256           69
#> 5 COVID STEROID NIV         16            2
#> 6 COVID STEROID IV          13            4