title: Convert column to date-format with a space and milliseconds
body: <p>I've been trying to figure this out for a few days now, and seem to be having difficulties doing a simple date column conversion in R.</p>
  
  <p>I need to format the date and time before I am able to use the to.period command. I would like to format the mydata$Time column, and convert the entire series to 4hr OHLC bar.</p>
  
  <p>Below is the code input;</p>
  
  <pre><code>&gt; mydata = read.csv("AUDJPY.csv")
  &gt; colnames(mydata) &lt;- c("Pair","Time","Bid","Ask")
  &gt; head(mydata)
       Pair                  Time    Bid    Ask
  1 AUD/JPY 20140501 00:00:00.301 94.874 94.893
  2 AUD/JPY 20140501 00:00:00.312 94.876 94.895
  3 AUD/JPY 20140501 00:00:00.316 94.876 94.882
  4 AUD/JPY 20140501 00:00:00.317 94.877 94.884
  5 AUD/JPY 20140501 00:00:00.403 94.877 94.885
  6 AUD/JPY 20140501 00:00:00.420 94.877 94.887
  &gt; mydata$Time &lt;- strptime(as.character(mydata$Time),"%Y%m%d_%H:%M:%S.%f")
  &gt; head(mydata)
       Pair Time    Bid    Ask
  1 AUD/JPY &lt;NA&gt; 94.874 94.893
  2 AUD/JPY &lt;NA&gt; 94.876 94.895
  3 AUD/JPY &lt;NA&gt; 94.876 94.882
  4 AUD/JPY &lt;NA&gt; 94.877 94.884
  5 AUD/JPY &lt;NA&gt; 94.877 94.885
  6 AUD/JPY &lt;NA&gt; 94.877 94.887
  &gt; class(mydata$Time)
  [1] "POSIXlt" "POSIXt" 
  &gt; 
  </code></pre>
  
  <p>Please help!</p>