s-news
[Top] [All Lists]

calling update() inside a function

To: "'s-news@lists.biostat.wustl.edu'" <s-news@lists.biostat.wustl.edu>
Subject: calling update() inside a function
From: "Schwarz, Paul" <paul.schwarz@oregonstate.edu>
Date: Thu, 22 Aug 2002 10:09:23 -0700
Dear S-news readers,

I've written a simple function that calls update().  However, I can't seem
to get it work properly, and the problem appears related to passing the new
respsonse variable, newy, and specifying the formula.  I'm guessing that the
root cause is related to my confusion regarding objects, the names of
objects, and scoping rules in general.  Here's the function:

refit <- function(newy, model, ...){
  newfit <- update(model,
                   formula(newy ~ .),
                  )
  return(newfit)
}

I'm also hoping to use this function in R (in addition to S-PLUS), and I'm
wondering whether there are differences in how this is implemented in R (as
opposed to S-PLUS).

I'm confused, and I'd be grateful for any help in sorting this out.

Thank you for your time and patience,

-Paul Schwarz


<Prev in Thread] Current Thread [Next in Thread>
  • calling update() inside a function, Schwarz, Paul <=