title: Struggling to convert 1min closing prices data to 5min in R
body: <p>Asked this question question recently and was advised to use the '<strong>to.minutes5()</strong>' function. However, upon doing so I get the following error: </p>
  
  <pre><code>Error in to.period(x, "minutes", k = 5, name = name, ...) : 
  unsupported type
  </code></pre>
  
  <p>My original text file has the date and time as to separate columns:</p>
  
  <pre><code>GBPUSD&lt;- read.table("GBPUSD.txt", sep=',')
  
  head(GBPUSD)
  
    V1           V2     V3     V4     V5     V6      V7    V8               
  1 &lt;TICKER&gt; &lt;DTYYYYMMDD&gt; &lt;TIME&gt; &lt;OPEN&gt; &lt;HIGH&gt;  &lt;LOW&gt; &lt;CLOSE&gt; &lt;VOL&gt; 
  2   GBPUSD     20010102 230100 1.5021 1.5021 1.5018  1.5018     4   
  3   GBPUSD     20010102 230200 1.5019 1.5019 1.5019  1.5019     4     
  4   GBPUSD     20010102 230300 1.5018 1.5019 1.5018  1.5019     4     
  5   GBPUSD     20010102 230400 1.5019 1.5019 1.5019  1.5019     4     
  6   GBPUSD     20010102 230500 1.5017 1.5018 1.5017  1.5018     4   
  </code></pre>
  
  <p>So the first step I undertook was to blend them into one column using the paste() function in a new 'TIME' column:</p>
  
  <pre><code>GBPUSD$Time &lt;-paste(GBPUSD[,2],GBPUSD[,3],sep=",") 
  </code></pre>
  
  <p>After which I created a POSIXct time stamp using the new merged 'TIME' (9th column):</p>
  
  <pre><code>time&lt;- as.POSIXct(GBPUSD[,9], format="%Y%m%d,%H%M%S")
  </code></pre>
  
  <p>Then I got around to creating an xts time series using the closing prices and time:</p>
  
  <pre><code>gbp&lt;- xts(GBPUSD[7], time)
  </code></pre>
  
  <p>However, when I call to.minutes5(gbp), I get an error.</p>
  
  <p>How do I convert the one minute closing prices in my text file to 5 minute prices without running a loop?</p>
  
  <p>Additionally, how would I go about converting 1min OHLC to 5min OHLC?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>When I try the advice put forth by khoxsey, I get an error on the following line:</p>
  
  <pre><code>raw_cable &lt;- read.table(header=FALSE, text=data, col.names=cn, colClasses=cl)
  "Error in textConnection(text) : invalid 'text' argument"
  </code></pre>
  
  <p>I presume this happens because I first imported a tabular data frame and deleted the first line:</p>
  
  <pre><code>data&lt;- read.table("GBPUSD.txt", sep=',')
  data &lt;- data[-1,] #deleted the initial header to add at a later step, as suggested
  </code></pre>