title: how to use aes_string for groups in ggplot2 inside a function when making boxplot
body: <p>new to ggplot2, I've scoured the web but still couldn't figure this out. 
  I understand how to plot a boxplot in ggplot2, my problem is that I can't pass along the variable I use for groups when it is inside a function. </p>
  
  <p>so, normally (i.e. NOT inside a function), I would write this:</p>
  
  <pre><code>ggplot(myData, aes(factor(Variable1), Variable2)) +
      geom_boxplot(fill="grey", colour="black")+
      labs(title = "Variable1 vs. Variable2" ) +
      labs (x = "variable1", y = "Variable2")
  </code></pre>
  
  <p>Where myData is my data frame
  Variable 1 is a 2 level factor variable
  Variable 2 is a continuous variable
  I want to make boxplots of Variable 1 by its 2 levels/groups
  and this works fine, 
  but as soon as I write this inside a function I couldn't get it to work. </p>
  
  <p>my attempt in writing the function:</p>
  
  <pre><code>myfunction = function (data, Variable1) {
      ggplot(data=myData, aes_string(factor("Variable1"), "Variable2"))+
      geom_boxplot(fill="grey", colour="black")+
      labs(title = paste("Variable1 vs. Variable2" )) +
      labs (x = "variable1", y = "Variable2")
  }
  </code></pre>
  
  <p>this only gives me a single boxplot(instead of 2), as if it never understood the factor(Variable1) command (and did a single boxplot of the entire Variable 2, rather than separate them by Variable 1 level first, then boxplot them). </p>