Adds arm indices (arms, narms) to a dataset and adds numeric identifiers for agent and class (if included in the data).

add_index(data.ab, agents = NULL, treatments = NULL)

Arguments

data.ab

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

  • studyID Study identifiers

  • dose Numeric data indicating the dose (must take positive values)

  • agent Agent identifiers (can be numeric, factor or character)

  • y Numeric data indicating the aggregate response for a continuous outcome. Required for continuous data.

  • se Numeric data indicating the standard error for a given observation. Required for continuous data.

  • r Numeric data indicating the number of responders within a study arm. Required for binomial or poisson data.

  • n Numeric data indicating the total number of participants within a study arm. Required for binomial data or when modelling Standardised Mean Differences

  • E Numeric data indicating the total exposure time for participants within a study arm. Required for poisson data.

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

  • standsd An optional column of numeric data indicating reference SDs used to standardise treatment effects when modelling using Standardised Mean Differences (SMD).

agents

A character string of agent names used to force a particular agent ordering. Default is NULL, which automatically orders Placebo (dose=0) as agent 1 and then subsequent agents by the order given in data.ab

treatments

A character string of treatment names used to force a particular treatment ordering. Default is NULL, which automatically orders Placebo (dose=0) as treatment 1 and then subsequent treatments by the order of agents and doses (smallest to highest) given in data.ab

Value

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

  • arm Arm identifiers coded for each study

  • narm The total number of arms in each study

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