Q:

what data type is produced by mapply()?

This is what my code looks like.  a, b, c, and d are scalers, e is a list of vectors.  A, B, C and D are vectors.  
GetOutput=function(a,b,c,d){
  e=FunOther(a,b,c,d)
  i=mean(e$f)
  j=mean(e$g)
  k=abs(mean(e$h))
  return(list(b=b,i=i,j=j,k=k))
}
Output=mapply(GetOutput,A,B,C,D)

GetOutput will return a list of 4 scalers.  I want to factor this up to a matrix of inputs and a matrix of outputs.  I had been using a for loop but I thought I would try mapply instead.
Suppose A, B, C and D have a length 100.  I just want to get a vector with length 100 which give me all of the i's so that I can calculate their minima.  Then the same for the j's and k's.  This is part of a Monte Carlo study.   But I am having trouble understanding the Output object.  It appears to be a list of lists.  What I thought would be a one liner turns into several operations.  The best I can come up with is:
Output2=as.data.frame(t(Output))
OutputMeans=c(mean(as.numeric(Output2$i)),
              mean(as.numeric(Output2$j)),
              mean(as.numeric(Output2$k)))

This seems just bananas to me.  I though I could operate on Output directly with the mean function without having to bother with all of these transformations.

A:

If you had instead written: return( c(b=b,i=i,j=j,k=k) ) , then each element in the list from mapply would have been a named vector, rather than what you did get  .... a list of lists. And since the 'simplify' argument would have let you return a matrix, you could have returned a non-recursive result as well.  Because mapply is so versatile, it gives you multiple levels of control of the returned structure.
Another R programming tip: Don't use '$' as an extraction function inside functions. If you are sure of your column name you can use `[['colname']] but then by using '[[' you can later generalize your function to accept column names as arguments, a feature which '$' will not support.

