[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

[Rd] The parsing of '{' and a function that equal to '{'

2010-05-14 Thread thmsfuller...@gmail.com
Hello All, I tried the sample code from the help. Although '{' is assigned to 'do', the call syntaxes for 'do' and '{' are not the same ('do' has ','s, but '{' has line breaks). I guess there is a difference in parsing the code block of 'do' and the code block of '{'. Could you please let me know

Re: [Rd] Restrict access to variables in parent environment

2010-05-14 Thread thmsfuller...@gmail.com
On Fri, May 14, 2010 at 10:13 AM, Simon Urbanek wrote: > > On May 14, 2010, at 10:29 AM, Jeff Ryan wrote: > >> This isn't like a local variable though, since any function above the >> baseenv() in the search path will also not be found. >> > > Yes, but that is a consequence of the request and henc

[Rd] Restrict access to variables in parent environment

2010-05-14 Thread thmsfuller...@gmail.com
Hello All, By default, a reference of a variable in a function cause R to look for the variable in the parent environment if it is not available in the current environment (without generating any errors or warnings). I'm wondering if there is a way to revert this behaviors, such that it will not l

[Rd] What functions are called internally in R to resolve what variable is referred?

2010-05-13 Thread thmsfuller...@gmail.com
Hello All, If I refer to a variable 'x', 'x' will be searched in the current frame or the parent frame, or the parent of the parent frame, etc., until it is found (or not found at all)? Could you please show me what code in R source that handles this? Is it in the C code or the R code? Thanks, To