title: How to find all numeric columns in data
body: <p>I'm trying to find all names of columns that only have <code>numeric</code> data in them.  For this I'm making use of <code>is.numeric</code> and applying it over my data like this:</p>
  
  <pre><code>&gt; sapply(ds[vars], is.numeric)
        MinTemp       MaxTemp      Rainfall   Evaporation      Sunshine   WindGustDir WindGustSpeed    WindDir9am    WindDir3pm  WindSpeed9am 
           TRUE          TRUE          TRUE          TRUE          TRUE         FALSE          TRUE         FALSE         FALSE          TRUE 
   WindSpeed3pm   Humidity9am   Humidity3pm   Pressure9am   Pressure3pm      Cloud9am      Cloud3pm       Temp9am       Temp3pm     RainToday 
           TRUE          TRUE          TRUE          TRUE          TRUE          TRUE          TRUE          TRUE          TRUE         FALSE 
   RainTomorrow 
          FALSE 
  </code></pre>
  
  <p>The above makes sense according to my data. Column <code>WindGustDir</code> and <code>WindDir9am</code> for example have values like <code>NW</code> so thats why they are <code>FALSE</code>.</p>
  
  <p>When I apply this on my data to get names of all columns that are numeric, I DON'T expect to see columns that are non-numeric - for example <code>WindGustDir</code> and <code>WindDir9am</code>. However, I'm seeing it <code>WindDir9am</code> and not <code>WindGustDir</code>. <strong>Question</strong> I don't understand why is this the case. How can I fix it so I only get numeric columns?</p>
  
  <pre><code>&gt; numerics &lt;- names(ds)[which(sapply(ds[vars], is.numeric))]
  &gt; numerics
   [1] "Date"         "Location"     "MinTemp"      "MaxTemp"      "Rainfall"     "Sunshine"     "WindDir9am"   "WindDir3pm"   "WindSpeed9am"
  [10] "WindSpeed3pm" "Humidity9am"  "Humidity3pm"  "Pressure9am"  "Pressure3pm"  "Cloud9am"     "Cloud3pm"  
  </code></pre>
  
  <p>Here is the link to the data I'm using: <a href="http://rattle.togaware.com/weather.csv" rel="nofollow">http://rattle.togaware.com/weather.csv</a></p>
  
  <p><strong>Edit</strong></p>
  
  <pre><code>&gt; vars
   [1] "MinTemp"       "MaxTemp"       "Rainfall"      "Evaporation"   "Sunshine"     
   [6] "WindGustDir"   "WindGustSpeed" "WindDir9am"    "WindDir3pm"    "WindSpeed9am" 
  [11] "WindSpeed3pm"  "Humidity9am"   "Humidity3pm"   "Pressure9am"   "Pressure3pm"  
  [16] "Cloud9am"      "Cloud3pm"      "Temp9am"       "Temp3pm"       "RainToday"    
  [21] "RainTomorrow"
  </code></pre>