title: Combine elements of each level of a list using pre-specified function in R
body: <p>I am working in R and have a list, we'll say named <code>x</code>. This list is multidimensional, it contains 100 different outputs of the <code>survival::survConcordance()</code> function (i.e. so <code>x[[i]][j]</code> where <code>i</code> is the number of different <code>survConcordance()</code> ouputs (i = 1 to 100) and <code>j</code> is the number of elements in each output (j = 1 to 5). What I want to do is for each <code>i</code>, compute my concordance statistic, which is a function of the output of <code>survConcordance()</code> according to this formula: (for each <code>i</code>) <code>concordance &lt;- (x[[i]][1]+(x[[i]][3] / 2))/(x[[i]][1]+x[[i]][2]+x[[i]][3])</code>. However, I'm struggling to figure out how to do this. Although I'm virtually certain the solution lies somewhere within the <code>lapply()</code> family of functions. Any ideas?</p>