Closed aaronxs closed 6 years ago
Dear Aaron,
In order to automate the input for pairwise() in such a way, you can use the long arm-based format in the following way.
max.arm <- 4
t <- unlist(apply(datt[, paste0("t", 1:max.arm)], 2, list))
r <- unlist(apply(datt[, paste0("r", 1:max.arm)], 2, list))
n <- unlist(apply(datt[, paste0("n", 1:max.arm)], 2, list))
s <- rep(datt$study, max.arm)
pairwise(treat = t, event = r, n = n, studlab = s)
Note, you have to provide the study labels (argument 'studlab') if you use the long arm-based format.
Best wishes, Guido
Hi,
I am trying to use the pairwise function but I am having trouble with the format of the inputs. Initially I have:
But because the data I get sometime will have more/less than 4 arms. Is it possible to input the values for event, n and treat along the following lines?
Thank you! Aaron