Add follow-up time and arm indices to a dataset
add_index.RdAdds follow-up time (fups, fupcount) and arm (arms, narms) indices to a dataset.
Arguments
- data.ab
A data frame of arm-level data in "long" format containing the columns:
studyIDStudy identifierstimeNumeric data indicating follow-up timestreatmentTreatment identifiers (can be numeric, factor or character)classAn optional column indicating a particular class code. Treatments with the same identifier must also have the same class code.
- reference
A number or character (depending on the format of
treatmentwithindata.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).
Value
A data frame similar to data.ab but with additional columns:
armArm identifiers coded for each studyfupcountFollow-up identifiers coded for each studyfupsThe total number of follow-up measurements in each studynarmThe 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).