title: Erroneous code diagnostics report in RStudio when sourcing functions via source
body: <p>I'm working in <a href="https://www.rstudio.com/" rel="noreferrer">RStudio</a> on a simple analysis where I source some files via the <code>source</code> command. For example, I have this file with some simple analysis:</p>
  
  <h1>analysis.R</h1>
  
  <pre><code># Settings ----------------------------------------------------------------
  
  data("mtcars")
  source("Generic Functions.R")
  
  # Some work ---------------------------------------------------------------
  
  # Makes no sense
  mtcars$mpg &lt;- CleanPostcode(mtcars$mpg)
  </code></pre>
  
  <p>The <em>generic functions</em> file has some simple functions that I use to derive graphs and do repetitive tasks. For example the used CleanPostcode function would look like that:</p>
  
  <h1>Generic Functions.R</h1>
  
  <pre><code>#' The file provides a set of generic functions 
  
  # String manipulations ----------------------------------------------------
  
  # Create a clean Postcode for matching
  CleanPostcode &lt;- function(MessyPostcode) {
    MessyPostcode &lt;- as.character(MessyPostcode)
    MessyPostcode &lt;- gsub("[[:space:]]", "", MessyPostcode)
    MessyPostcode &lt;- gsub("[[:punct:]]", "", MessyPostcode)
    MessyPostcode &lt;- toupper(MessyPostcode)
    cln_str &lt;- MessyPostcode
    return(cln_str)
  }
  </code></pre>
  
  <p>When I run the first file, the objects are available in the global environment:</p>
  
  <p><a href="https://i.stack.imgur.com/b5Dz3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/b5Dz3.png" alt="Global environment"></a></p>
  
  <p><em>There are some other function in the file but they are not relevant to the described problem.</em></p>
  
  <p>Nevertheless the RStudio sees the object as not available in scope, as illustrated by the yellow triangle next to the code:</p>
  
  <p><a href="https://i.stack.imgur.com/zNAj7.png" rel="noreferrer"><img src="https://i.stack.imgur.com/zNAj7.png" alt="problem"></a></p>
  
  <h1>Question</h1>
  
  <p>Is there a way to make RStudio stop doing that. Maybe changing something to the <code>source</code> command? I tried <code>local = TRUE</code> and got the same thing. The code works with no problems, I just find it annoying.</p>
  
  <hr>
  
  <p><em>The report was generated on the <strong>version 0.99.491</strong> of RStudio.</em></p>