title: Embarrassingly basic RStudio Dilemma -- "Error: object 'num' not found"
body: <p>I've encountered a strange problem with RStudio. Using the following code in the <strong>console</strong>: </p>
  
  <pre><code>test &lt;- 'This is a test'
  test
  num &lt;- 2
  num
  </code></pre>
  
  <p>it properly returns the string and number associated with test and num, respectively. Furthermore, the variables are registered in the "Environment" tab. </p>
  
  <p>The problem arises when I go to run a script. After creating an R File with the identical code and pressing 'Run', the only console output is:</p>
  
  <pre><code>&gt; num
  Error: object 'num' not found
  </code></pre>
  
  <p>And the variables are not registered in the "Environment" tab. </p>
  
  <p><strong>Why is my code working in the console, but not in an R script?</strong></p>
  
  <p>I am sorry for such a basic question, but I am new to RStudio and this is incredibly frustrating. Thank you!  </p>