title: Passing a String Via Index in R
body: <p>I'm trying to use a for loop to pull subsets of data out of a dataframe with R.</p>
  
  <p>I have a little vector to hold all the possible occurences of the names in that column</p>
  
  <p><code>meter_class&lt;-c("one_s_120","nine_s_120", "nine_s_480","fortyfive_s_120", "fortyfive_s_480")
  </code></p>
  
  <p>Whenever I try to address it by index reference, it fails.  Either nothing in the data subset survives (NULLs everywhere), or R complains about not passing the right argument by using <code>meter_class[1]</code></p>
  
  <pre><code>attach(meter_class[1])
  Error in attach(meter_class[1]) : file 'one_s_120' not found
  subset(cal, cal$Form==as.character(meter_class[1]))
  [1] Test     Amps     Type     Accuracy Voltage  Form 
  &lt;0 rows&gt; (or 0-length row.names)
  </code></pre>
  
  <p>Also, here's the output of <code>dput</code> on the datafram <code>cal</code>:</p>
  
  <pre><code>    structure(list(Test = structure(c(3L, 3L, 3L, 3L, 3L, 3L, 3L, 
  3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
  1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 
  4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
  2L, 2L, 2L, 2L, 2L), .Label = c("Burst", "ESD", "Inspection", 
  "Surge"), class = "factor"), Amps = c(15, 15, 1.5, 2.5, 2.5, 
  0.25, 2.5, 2.5, 0.25, 2.5, 2.5, 0.25, 2.5, 2.5, 0.25, 15, 15, 
  1.5, 2.5, 2.5, 0.25, 2.5, 2.5, 0.25, 2.5, 2.5, 0.25, 2.5, 2.5, 
  0.25, 15, 15, 1.5, 2.5, 2.5, 0.25, 2.5, 2.5, 0.25, 2.5, 2.5, 
  0.25, 2.5, 2.5, 0.25, 15, 15, 1.5, 2.5, 2.5, 0.25, 2.5, 2.5, 
  0.25, 2.5, 2.5, 0.25, 2.5, 2.5, 0.25), Type = structure(c(2L, 
  1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 
  3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 
  2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 
  1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L, 2L, 1L, 3L), .Label = c("Lag - 0.5", 
  "Unity - Full", "Unity - Light"), class = "factor"), Accuracy = c(-0.011, 
  0.012, 0.027, 0.033, 0.076, 0.006, 0.052, 0.046, -0.016, 0.021, 
  0.008, 0.023, 0.034, 0.036, 0.038, 0.002, 0.012, 0.097, 0.055, 
  0.093, 0.033, 0.068, 0.048, -0.016, 0.042, 0.03, 0.035, 0.041, 
  0.024, 0.027, 0.004, -0.012, 0.002, 0.038, 0.084, 0.015, 0.049, 
  0.045, -0.009, 0.025, 0.002, 0.029, 0.03, 0.032, 0.064, 0.011, 
  0.024, 0.033, 0.054, 0.085, 0.027, 0.071, 0.059, 0.01, 0.051, 
  0.012, 0.051, 0.048, 0.04, 0.051), Voltage = c(120, 120, 120, 
  120, 120, 120, 480, 480, 480, 120, 120, 120, 480, 480, 480, 120, 
  120, 120, 120, 120, 120, 480, 480, 480, 120, 120, 120, 480, 480, 
  480, 120, 120, 120, 120, 120, 120, 480, 480, 480, 120, 120, 120, 
  480, 480, 480, 120, 120, 120, 120, 120, 120, 480, 480, 480, 120, 
  120, 120, 480, 480, 480), Form = structure(c(3L, 3L, 3L, 2L, 
  2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 2L, 2L, 
  2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 2L, 2L, 2L, 
  2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 
  2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("45S", "9S", "i210plus"
  ), class = "factor")), .Names = c("Test", "Amps", "Type", "Accuracy", 
  "Voltage", "Form"), class = "data.frame", row.names = c(NA, -60L
  ))
  </code></pre>
  
  <p>I know this is a simple thing to do if you know how to do it...Can anyone light the way?</p>
  
  <p>Thanks!</p>