title: Extract specific text lines from R output
body: <p>I'm trying to extract specific information from a result that I get from a R function package. I'm  only familiar with Python so learning R language gives me some confusion.</p>
  
  <p>Assuming this is the output of appnn (after printing it), a package that predicts protein aggregation</p>
  
  <pre><code>Prediction: 
  $sequence
  [1] "IFYFYGTTY"
  
  $overall
  [1] 1.076839
  
  $aminoacids
            [,1]
   [1,] 1.076839
   [2,] 1.076839
   [3,] 1.076839
   [4,] 1.076839
   [5,] 1.076839
   [6,] 1.076839
   [7,] 1.028888
   [8,] 1.011057
   [9,] 1.011057
  
  $hotspots
  $hotspots[[1]]
  [1] 1 9
  </code></pre>
  
  <p>Now all I need is just read the last 2 numbers (1 and 9), and from that I will have to extract a portion of the given string determined by these number (in this case it is the whole string since its length spans from spot 1 to 9).</p>
  
  <p>In python it's rather simple but I have no idea how to do it with R.
  Many thanks.</p>