title: R programming: Find all the factors from Data Frame
body: <p>I am trying to get the class type of the columns of a data frame. What I am doing is:</p>
  
  <pre><code>sapply(mydata,class)
  </code></pre>
  
  <p>But now, I want to find only those column names which are factor. I tried the following:</p>
  
  <pre><code>sapply(data,is.factor)
  </code></pre>
  
  <p>But it gives me:</p>
  
  <pre><code>ResponseFlag            Gender           Marital        OccupInput
   False                   True             True            False
  </code></pre>
  
  <p>How can I separate column names which are factor?</p>
  
  <p>Any help or idea will be appreciated.</p>