A while back I conducted multiple imputations with mice()
20 times, and saved these using the following:
for (i in 1:20)
{
write.csv(complete(imp20, i), file=paste("imp", i, ".csv", sep=""))
}
Now I would like to derive an average n and % for a variable named "remitted" (referring to remission in psychosis) by “sexabuse” (this variable refers to childhood sexual abuse) across all of these 20 data-frames. Rather than doing it 20 times separately and then deriving an average by hand I was hoping there was an easier way of doing it in R. I will be grateful for any suggestions. A small proportion of my data is presented below. Thank you for your help.
> head(df, 10)
sexabuse remitted
1 0. No 1. Yes
2 0. No 0. No
3 0. No 0. No
4 0. No 0. No
5 0. No 0. No
6 1. Yes 1. Yes
7 1. Yes 0. No
8 0. No 0. No
9 0. No 0. No
10 0. No 1. Yes