[R] summary of problem with mCall function.

Douglas Bates
Sat, 10 Sep 2005 16:58:32 -0000

On 9/7/05, Bill Shipley <bill.shipley at usherbrooke.ca>
wrote:
> Last week I posted a question concerning the mCall function, which is
> used to create self-starting functions and is described in the book by
> Pinheiro, J.C. and Bates, D.M. (Mixed-effects models in S and S-PLUS).
> On page 345 one finds the following call:
>
>
>
> xy<-sortedXyData(mCall[["x"]], LHS,data)
>
>
>
> It is necessary to replace the "x" in the call to mCall by the
actual
> variable name for the dependent variable.  The error message that I was
> getting was due to the fact that I had called by dependent variable in
> the data frame (data) by another name than x without changing this in
> the call to mCall.

mCall isn't a function.  It's a matched call created by the match.call
function.  The purpose of having such a matched call is to be able to
map the actual arguments to the formal arguments.  You need to know
which names to evaluate in the data frame and you can only get that
information from the matched call.