title: R-Project if else syntax
body: <p>I'm working through a tutorial and am having a tough time on syntax. I cannot see where I'm going wrong but I'm getting error messages from the console.</p>
  
  <p>I have a list of 300 csv files in a directory. A user would input the number (id) of the file they are seeking info on. The format is like so: 001.csv, 002.csv, 090.csv 250.csv etc etc.</p>
  
  <p>The function is to convert the input into a string that is the csv file name. e.g. if id is 5, return 005.csv. If the input in 220, output 220.csv.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>csvfile &lt;- function(id) {
    if (id &lt; 10) { paste0(0,0,id,".csv"
    } else if (id &lt; 100) {paste0(0,id,".csv"
    }else paste0(id,".csv")
  }
  </code></pre>
  
  <p>Here is the error that the console returns:</p>
  
  <pre><code>&gt; csvfile &lt;- function(id) {
  + if (id &lt; 10) { paste0(0,0,id,".csv"
  + } else if (id &lt; 100) {paste0(0,id,".csv"
  Error: unexpected '}' in:
  "if (id &lt; 10) { paste0(0,0,id,".csv"
  }"
  &gt; }else paste0(id,".csv")
  Error: unexpected '}' in "}"
  &gt; }
  </code></pre>
  
  <p>I can see R is not liking some of my '}' but cannot figure out why? What's wrong with my syntax?</p>