Use Hourly data in ts and window function
<p>I have hourly data like the sample below that I am trying to create a time-series from and use the window function with.  My end goal is to use this to train an Arima model.  I'm having a hard time getting <code>ts()</code> or <code>window()</code> to work with my date time format.  I've also tried using <code>msts()</code> but couldn't get it to work with the date time format.  I have gotten <code>xts()</code> to work, but it doesn't seem to work correctly with the <code>window()</code> or <code>Arima()</code>.</p>

<p>Is it possible to use this date time format with <code>ts()</code> and the <code>window()</code> function?  Any tips are greatly appreciated.</p>

<p>Code:</p>

<pre><code>tsData &lt;- ts(SampleData$MedTime[1:24],start='2015-01-01 00:00', frequency=168)

train &lt;- window(tsData,end='2015-01-01 15:00')
</code></pre>

<p><strong>Edit Note</strong> The data for this problem has been truncated to only 24 observations from the initial 525 provided. As a result, the <code>window()</code> call has been modified as well to a time within the truncated range.</p>

<p>Data:</p>

<pre><code>dput(SampleData[1:24,c("DateTime","MedTime")])
</code></pre>

<blockquote>
  <p>SampleData = structure(list(DateTime = c("2015-01-01 00:00", "2015-01-01 01:00", 
                              "2015-01-01 02:00", "2015-01-01 03:00", "2015-01-01 04:00", "2015-01-01 05:00", 
                              "2015-01-01 06:00", "2015-01-01 07:00", "2015-01-01 08:00", "2015-01-01 09:00", 
                              "2015-01-01 10:00", "2015-01-01 11:00", "2015-01-01 12:00", "2015-01-01 13:00", 
                              "2015-01-01 14:00", "2015-01-01 15:00", "2015-01-01 16:00", "2015-01-01 17:00", 
                              "2015-01-01 18:00", "2015-01-01 19:00", "2015-01-01 20:00", "2015-01-01 21:00", 
                              "2015-01-01 22:00", "2015-01-01 23:00"), MedTime = c(11, 14, 
                                                                                   17, 5, 5, 5.5, 8, NA, 5.5, 6.5, 8.5, 4, 5, 9, 10, 11, 7, 6, 7, 
                                                                                   7, 5, 6, 9, 9)), .Names = c("DateTime", "MedTime"), row.names = c(NA, 
                                                                                                                                                     24L), class = "data.frame")</p>
</blockquote>