title: How to barplot select rows of data from a dataframe in R?
body: <p>This is my first time submitting a question, so apologies in advance if my formatting is not optimal.</p>
  
  <p>I have a dataframe with roughly 6,000 rows of data in 2 columns, and I want to be able to pull out individual rows (and multiple rows together) to barplot.</p>
  
  <p>I read my file in as a dataframe, here is a very small subset:</p>
  
  <pre><code>    gene     log2
  1 SMa0002 0.457418
  2 SMa0005 1.116950
  3 SMa0007 0.686749
  4 SMa0009 0.169450
  5 SMa0011 0.393365
  6 SMa0013 0.601940
  </code></pre>
  
  <p>So what I would want to be able to do is have a barplot where the x axis is a number of genes (SMaXXX, SMaXXX, SMaXXX, etc.), and the y-axis is the log2 column. It only has (+) values displayed, but there are (-) values as well. I have no real preference about whether I use barplot or geom_bar in ggplot2, or another plotter.</p>
  
  <p>I know how to just plot the dataframe; </p>
  
  <pre><code>ggplot(df, aes(x = gene, y = log2)) + geom_bar(stat = "identity")
  </code></pre>
  
  <p>I've tried playing around with using 'match' but I haven't been able to figure out how to make that work. Ideally the code is versatile so I can just punch in different SMaXXXX codes to generate many different plots.</p>
  
  <p>Thanks for reading!</p>