title: Extract column of data frame based on logical vector
body: <p>I would like to extract the columns of a data frame based on logical vector. My data frame <code>df</code> is</p>
  
  <pre><code>structure(list(Sepal.Length = c(5.1, 4.9, 4.7, 4.6, 5, 5.4), 
      Sepal.Width = c(3.5, 3, 3.2, 3.1, 3.6, 3.9), Petal.Length = c(1.4, 
      1.4, 1.3, 1.5, 1.4, 1.7), Petal.Width = c(0.2, 0.2, 0.2, 
      0.2, 0.2, 0.4), Species = structure(c(1L, 1L, 1L, 1L, 1L, 
      1L), .Label = c("setosa", "versicolor", "virginica"), class = "factor")), .Names = c("Sepal.Length", 
  "Sepal.Width", "Petal.Length", "Petal.Width", "Species"), row.names = c(NA, 
  6L), class = "data.frame")
  </code></pre>
  
  <p>And I have a logical vector say <code>x &lt;- c(TRUE,FALSE,TRUE,TRUE,FALSE)</code> . How to extract the columns of logical <code>TRUE</code></p>