title: Automate R based on text file
body: <p>I have a text file in the format:</p>
  
  <pre><code>&gt;species1
  0.432
  0.323
  0.987
  (possibly continued...)
  &gt;species2
  -0.332
  </code></pre>
  
  <p>and so on...</p>
  
  <p>I have 4 variables, <code>totalcomsize, totalp, pol_pla, nvp_vp</code> lets say they are constant so easy to hardcode in. How could I take all the values under <code>&gt;species1</code> and plot them vs each of the 4 above-mentioned variables, and then save a plot with the name <code>species1_vs_variable</code> where variable is one of the ones above. I want to do this using R, and bash code, can anyone help?</p>
  
  <hr>
  
  <p><strong>EDITED</strong></p>
  
  <p>Okay so as a short example, the 4 variables mentioned above correspond to a FIXED set of points, so each one could be <code>[1, 2, 3, 4, 5]</code> for example. Each line beginning with a <code>&gt;</code> indicates that there is a new set of data to be compared to each of the 4 aforementioned variables. So <code>&gt;Species1</code> could be <code>&gt;Drosophila Melanogaster</code>, and EVERY number underneath it separated by a new line is a value included in that set corresponding to D.Melanogaster. But you basically want all the values up until the next line that begins with a <code>&gt;</code>. So you may end up with a set <code>[0.2, 0.4, 0.6]</code> for the species drosophila melanogaster. Then you want to make a line plot of that dataset for each 4 fixed variables (<code>totalcomsize, totalp, pol_pla, nvp_vp</code>) and save the plot, giving it a filename corresponding to the species. I want to automate this because there are MANY MANY species. Which mean #species*4 graphs to manually plot. So you can see why I want to do this. I did manage to put it in a better format where species are tab separated on one line, e.g.</p>
  
  <pre><code>anthomyiidae_sp_2_NVP   anthomyiidae_sp_1_NVP   anthomyiidae_sp_3_NVP
  -0.221                  0.188                   0.989
  0.972                   0.092                   0.924
  </code></pre>
  
  <p>and then their values are on the next line in tab delimited format, and so on until there are no more values. I was able to import this file and it sort of helped. But I could still use a good suggestion.</p>