Skip to content
Back to formatted view

Raw Message

Message-ID: <49806BD8.1090804@c2i.net>
Date: 2009-01-28T14:29:44Z
From: Harald Eikrem
Subject: putting match.call to good use

( I just became aware the mailer enforces html bodies, as such removed 
by the list handler.  Sorry about that.  My message was )

I have this function

slm <- function(fun=lm, ...) {
   #ilm <- eval(match.call()[-1]);  # no way
   ilm <- eval(parse(text=sub("^list", deparse(substitute(fun)), 
deparse(substitute(...())))));
   ...

The latter actually does the trick, but recognising how some gurus hate 
parse, I would like to know if this can anyhow be done with match.call, 
or any other reasonable solution.

The issue here is that lm (and likewise glm, bayesglm, etc.) returns the 
function call, which needs to show up as the original args to slm of course.

   ~~harald e