I'm working with the mice (multiple imputations) library. When it executes, it generates an object which is essentially an array of data frames, one for each column of the original data set on which you're performing the calculation. Each of these data frames contains the results of each "iteration" of the multiple imputation run.
To reference one of these, e.g. for column X1 in the original data set, I would use:
impData$imp$X1
That would generate something like this if i set the # of iterations to 5:
I would like to compute the median for each of these imputations...
For an individual one, I use:
impData$imp$X1$'med'<- apply(impData$imp$X1, 1, FUN = median)
That works fine for one column of my data set. But if I want to write a loop where I iterate from i = 1 to 50 (all columns), I am not sure how to substitute for "X1" in the above equation the appropriate term based on "i" that will work. I think of it as indirect referencing, but am not sure of the syntax.
Thanks, Bob