Re: [Rd] Is it possible to generate an error when a function is reassigned?

2010-05-23 Thread Duncan Murdoch
thmsfuller...@gmail.com wrote: Hello All, length() is a function. If I accidentally assign something else to length, it will give me some unexpected results. Although the freedom to redefine any funcion maybe good in sometime, it may be unwanted in many other cases. Is there a way to forbidden

[Rd] Is it possible to generate an error when a function is reassigned?

2010-05-23 Thread thmsfuller...@gmail.com
Hello All, length() is a function. If I accidentally assign something else to length, it will give me some unexpected results. Although the freedom to redefine any funcion maybe good in sometime, it may be unwanted in many other cases. Is there a way to forbidden such changes on functions? -- T

Re: [Rd] possible bug in formals

2010-05-23 Thread Uwe Ligges
On 23.05.2010 16:14, Josef Leydold wrote: Hi, I am a little bit surprised by the following output of 'formals'. Is this the intended behavior? f<- function(a=1,b=-1) { a+b } class(formals(f)$a) [1] "numeric" class(formals(f)$b) [1] "call" Josef Yes, the arguments have not yet been

[Rd] possible bug in formals

2010-05-23 Thread Josef Leydold
Hi, I am a little bit surprised by the following output of 'formals'. Is this the intended behavior? > f <- function(a=1,b=-1) { a+b } > class(formals(f)$a) [1] "numeric" > class(formals(f)$b) [1] "call" Josef -- -