r - Limiting variable scope -


I am trying to write a function that limits the radius of the variable, for example,

  source ("LimitScope.R") y = 0f = function {error} is a global variable x = y} error as  

Thought to test the environment, but in reality it was not sure how to do it.

Why

I read R for undergradation. In their first couple of practicals, some of them always forget about the variable scope, so their submission work does not work. For example, I always get something like this:

  n = 10 f = function (x) {# error # ra raises i only test for source f and for some test cases i return i After the quick work was done that would be the 'closed' radius. As you can imagine, it is not particularly strong, because it will be offered only for some practical.   

I'm not sure that you want to do this in general, but local () The function should help, as the codetools library needs.

In your example, try

  f = local (function () {...}, baseenv ())  


Comments