title: How to use 'head' in r to show certain variable value?
body: <p>I use <code>head(df,20)</code> to see the first twenty rows of my data.
  Then I want to see the first twenty rows of my data where VAR1 equal to 1.
  I use this <code>head(df[df$VAR1==1],20)</code>
  But it shows </p>
  
  <pre><code>Error in `[.data.frame`(df, df$VAR1== 1) : 
    undefined columns selected
  </code></pre>
  
  <p>How do I fix it? 
  Thanks in advance.</p>