Skip to contents

Adds follow-up time (fups, fupcount) and arm (arms, narms) indices to a dataset.


add_index(data.ab, reference = 1)



A data frame of arm-level data in "long" format containing the columns:

  • studyID Study identifiers

  • time Numeric data indicating follow-up times

  • treatment Treatment identifiers (can be numeric, factor or character)

  • class An optional column indicating a particular class code. Treatments with the same identifier must also have the same class code.


A number or character (depending on the format of treatment within data.ab) indicating the reference treatment in the network (i.e. those for which estimated relative treatment effects estimated by the model will be compared to).


A data frame similar to data.ab but with additional columns:

  • arm Arm identifiers coded for each study

  • fupcount Follow-up identifiers coded for each study

  • fups The total number of follow-up measurements in each study

  • narm The total number of arms in each study

If treatment or class are non-numeric or non-sequential (i.e. with missing numeric codes), treatments/classes in the returned data frame will be numbered and recoded to enforce sequential numbering (a warning will be shown stating this).


# Add indices to osteoarthritis pain dataset
data.ab <- add_index(osteopain)
#> Reference treatment is `Pl_0`

# Add indices to dataset using different network reference treatment
data.ab <- add_index(osteopain, reference=3)
#> Reference treatment is `Ce_200`