On Fri, Jun 28, 2013 at 3:07 PM, Ben Bolker <bbolker@gmail.com> wrote:

> On 13-06-28 03:57 PM, Peter Meilstrup wrote:
> > Well, once you begin messing with eval.parent(), you _are_ telling R
> > what environment to work in, and things have the potential to go wrong
> > at that point because you're telling R to work in environment you don't
> > know anything about. Having to be explicit with a :: is just
> > compensating for an earlier thing you "shouldn't need to" be doing with
> > environments (in my opinion.)
>
>   What would your preferred idiom be for this task (calling another
> function with all of the arguments of the previous call, without
> uglifying the call in the process)?  I read your e-mail about making the
> comparison with S3 method dispatch, but to be honest I don't understand
> it very well -- don't know if those particular techniques are applicable
> here ... ?
>
>   Ben
>

In the case of lmer you could do this:

delegate <- structure(NULL, class="delegate")

#' @S3method glmer delegate
glmer.delegate <- glmer

lmer <- function (formula, data, family = NULL, blahblahblah, ...) {
  if (!is.null(family)) {
    UseMethod("glmer", delegate)
  }
  #...
}

###

Peter

	[[alternative HTML version deleted]]

