Re: [R] Function redefinition - not urgent, but I am curious

2008-04-21 Thread Richard . Cotton
Suppose I write: f1 - function(x) x + 1 f2 - function(x) 2 * f1(x) f2(10) # 22 f1 - function(x) x - 1 f2(10) # 18 This is quite obvious. But is there any way to define f2 in such a way that we freeze the definition of f1? f1 - function(x) x+1 f1frozen - f1 f2 - function(x)

Re: [R] Function redefinition - not urgent, but I am curious

2008-04-21 Thread Peter Dalgaard
[EMAIL PROTECTED] wrote: Suppose I write: f1 - function(x) x + 1 f2 - function(x) 2 * f1(x) f2(10) # 22 f1 - function(x) x - 1 f2(10) # 18 This is quite obvious. But is there any way to define f2 in such a way that we freeze the definition of f1? f1 - function(x) x+1 f1frozen

[R] Function redefinition - not urgent, but I am curious

2008-04-18 Thread Alberto Monteiro
This is just my curiousity working. Suppose I write: f1 - function(x) x + 1 f2 - function(x) 2 * f1(x) f2(10) # 22 f1 - function(x) x - 1 f2(10) # 18 This is quite obvious. But is there any way to define f2 in such a way that we freeze the definition of f1? f1 - function(x) x + 1 f2 -

Re: [R] Function redefinition - not urgent, but I am curious

2008-04-18 Thread Gabor Grothendieck
Try f2 - local({f1 - f1; function(x) 2 * f1(x) }) On Fri, Apr 18, 2008 at 8:22 AM, Alberto Monteiro [EMAIL PROTECTED] wrote: This is just my curiousity working. Suppose I write: f1 - function(x) x + 1 f2 - function(x) 2 * f1(x) f2(10) # 22 f1 - function(x) x - 1 f2(10) # 18 This is

Re: [R] Function redefinition - not urgent, but I am curious

2008-04-18 Thread Dimitris Rizopoulos
://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: Alberto Monteiro [EMAIL PROTECTED] To: r-help@r-project.org Sent: Friday, April 18, 2008 2:22 PM Subject: [R] Function redefinition - not urgent, but I am curious This is just my