title: Creating a new variable column based on data from another column
body: <p>I'm pretty new to R, and programming in general, and I'm wondering the best way to loop through a column so I can add a column to the data frame further describing the observations I looped through.</p>
  
  <p>I currently have a list of amino acids and their positions on a protein that looks like this:</p>
  
  <pre><code>Residue Position
  H   1
  R   2
  K   3
  D   4
  E   5
  H   6
  R   7
  K   8
  D   9
  E   10
  </code></pre>
  
  <p>I'd like something that looks like this (where H, R, and K are basic amino acids, and D and E are acidic amino acids):</p>
  
  <pre><code>Residue Position    Properties
  H   1   Basic
  R   2   Basic
  K   3   Basic
  D   4   Acidic
  E   5   Acidic
  H   6   Basic
  R   7   Basic
  K   8   Basic
  D   9   Acidic
  E   10  Acidic
  </code></pre>
  
  <p>I'm really not sure where to start, and I'm having difficulty finding a good resource for this kind of situation in R.</p>
  
  <p>I started by trying to subset the data, but then I realized that wouldn't do the trick:</p>
  
  <pre><code>Basic
  h.dat &lt;- subset(all, all$Residue == "H")
  r.dat &lt;- subset(all, all$Residue == "R")
  k.dat &lt;- subset(all, all$Residue == "K")
  
  Acidic
  d.dat &lt;- subset(all, all$Residue == "D")
  e.dat &lt;- subset(all, all$Residue == "E")
  </code></pre>
  
  <p>Thanks!</p>
  
  <pre><code>Note: 
  H = Histidine (Basic amino acid)
  R = Arginine (Basic)
  K = Lysine (Basic)
  
  E = Glutamic Acid (Acidic)
  D = Aspartic Acid (Acidic)
  </code></pre>