title: "Run script section if condition satisfied" in R
body: <p>I'm currently using R to run MCMCglmm and have a long section of script (many lines) which take an fairly large amount of time (~5 days) to run. I saved the output and reload it now while having set the entire section in to comments (by putting # at the start of each line), but in the future I will need to tweak some things and rerun the chains. Currently if I want to do that I have to go and remove all those  #'s, run the script, and replace them when the chains are done. Is there a function I could wrap my occasionally used script in to to switch that bit of code on or off? a bit like this:</p>
  
  <pre><code>run_chains = "yes" # type yes or no
  run_script(if run_chains = "yes", run the following section of code:
  chain = MCMCglmm ....
  .... MCMCglmm code ....
  .... more MCMCglmm code ....
  , else ignore this section of code)
  </code></pre>