title: Weird behaviour on subsetting a data.frame, when using a leveled variable
body: <p>I just found a quite weird behaviour when subsetting a data.frame with a condition.
  The problem is, when I use a leveled variable to subset, the subset gets filtered for all levels.</p>
  
  <p>Here is an example where the error does not occur:</p>
  
  <pre><code>data &lt;- data.frame(names = c("Bob", "Alice", "Joe"), ages = c(18, 20, 43), sizes = c(180, 160, 176), group = c("0021", "9430", "0021"))
  
  for(i in 1:length(data$names)){
    print(paste("Name: ", data$names[i], sep=""))
  
    # print out all group members
    print("Group Members:")
    group = subset.data.frame(data, data$group == data$group[i])
    for(j in 1:length(group$names)){
      print(paste("Name: ", group$names[j], sep=""))
    }
    print("---------------------------------")
  }
  </code></pre>
  
  <p>Now I am saving the <code>data$group[i]</code> into a variable and the data.frame does not get filtered at all:</p>
  
  <pre><code>data &lt;- data.frame(names = c("Bob", "Alice", "Joe"), ages = c(18, 20, 43), sizes = c(180, 160, 176), group = c("0021", "9430", "0021"))
  
  for(i in 1:length(data$names)){
    print(paste("Name: ", data$names[i], sep=""))
    group &lt;- data$group[i]
  
    # print out all group members
    print("Group Members:")
    group = subset.data.frame(data, data$group == group)
    for(j in 1:length(group$names)){
      print(paste("Name: ", group$names[j], sep=""))
    }
    print("---------------------------------")
  }
  </code></pre>
  
  <p>Can someone please explain to me, why this unexpected behaviour occurs? I do expect to get a String from the <code>data$group[i]</code> expression but get a leveled something.</p>