title: R force local scope
body: <p>This is probably not correct terminology, but hopefully I can get my point across.</p>
  
  <p>I frequently end up doing something like:</p>
  
  <pre><code>myVar = 1
  f &lt;- function(myvar) { return(myVar); }
  # f(2) = 1 now
  </code></pre>
  
  <p>R happily uses the variable outside of the function's scope, which leaves me scratching my head, wondering how I could possibly be getting the results I am.</p>
  
  <p>Is there any option which says "force me to only use variables which have previously been assigned values in this function's scope"? Perl's <code>use strict</code> does something like this, for example. But I don't know that R has an equivalent of <code>my</code>. </p>
  
  <hr>
  
  <p>EDIT: Thank you, I am aware of that I capitalized them differently. Indeed, the example was created specifically to illustrate this problem!</p>
  
  <p>I want to know if there is a way that R can automatically warn me when I do this.</p>
  
  <p>EDIT 2: Also, if Rkward or another IDE offers this functionality I'd like to know that too.</p>