s-news
[Top] [All Lists]

Calling rpart from a function

To: s-news@lists.biostat.wustl.edu
Subject: Calling rpart from a function
From: "Paul Lasky" <phlasky@earthlink.net>
Date: Thu, 14 Apr 2005 17:13:10 -0700
Domainkey-signature: a=rsa-sha1; q=dns; c=simple; s=test1; d=earthlink.net; h=Message-ID:X-Priority:Return-Receipt-To:Reply-To:X-Mailer:From:To:Subject:Date:MIME-Version:Content-Type; b=oXF08gLZ+8Imd3xg1MVdK+mu0b1XNlnlLYrVXOKAoH6NAspT8+NMU5EaiaSrzYJ7;
Reply-to: phlasky@earthlink.net

This is a tiresome inquiry that has been addressed many times in this form, but I just don't know how to do it.
 
 I wish to call the function rpart from a function that I wrote:
 
   myfunction = function(args ... ) {
     . . .
   temp = rpart(y ~ x1+x2+x3,  control=rpart.control(minsplit = n) )
 
 . . .
  }
 
Of course this type of call doesn't work because the frame referenced by myfunction can't access the main
frame where rpart resides.  Neither does the trick of  using 
   do.call("rpart.control", minsplit = n )
   do.call("rpart", args)
work.
 
 The S-Plus "Programmer's Manual"  cautions that a user must use a "custom frame" but doesn't explain
really how to do this.
 
 Can anyone advise on the correct procedure for calling library functions from within a scripted function ?
 
 Paul H. Lasky
 P & B Consultants
  
 
 
 
 
Paul Lasky
 

<Prev in Thread] Current Thread [Next in Thread>
  • Calling rpart from a function, Paul Lasky <=