title: R subsetting by date range
body: <p>seems simple enough and I've been through all similar questions and applied them all... I'm either getting nothing or everything...</p>
  
  <p>Trying to took at water temperatures (WTEMP) for specific date range(SAMPLE_DATE) 2007-06-01 to 2007-09-30   from (allconmon)</p>
  
  <p>here is my code so far...</p>
  
  <pre><code>bydate&lt;-subset(allconmon, allconmon$SAMPLE_DATE &gt; as.Date("2007-06-01") &amp; allconmon$SAMPLE_DATE &lt; as.Date("2007-09-30"))
  </code></pre>
  
  <p>Ive also tried this but get errors</p>
  
  <pre><code>bydate2&lt;- as.xts(allconmon$WTEMP,order.by=allconmon$SAMPLE_DATE)
  
   bydate2['2007-06-01/2007-09-30']
  
  Error in xts(x, order.by = order.by, frequency = frequency, .CLASS = "double",  : 
    order.by requires an appropriate time-based object
  </code></pre>
  
  <p>not sure what I'm doing wrong here... seems to work for other people</p>