title: reading and converting binary raw data with R
body: <p>I have a <a href="https://drive.google.com/file/d/0BxMpk0nhnJy6SFhxd2xuMzJYYlk/edit?usp=sharing" rel="noreferrer">file</a> which contains raw/binary data and ascii.
  It contains a time stamp and a unsigned16 bit value which represents a Speed. 
  I would like to plot that speed with 'R' and therefore read that file.</p>
  
  <p>The definition of the file is:</p>
  
  <p><em>number of milliseconds since midnight-In ascii <br/>
  + ':$' <br/>
  + BufferStr <br/>
  +  #13#10</em> <br/></p>
  
  <p>The BufferString then contains the following information I would like to extract:</p>
  
  <p><em>Byte 3: Sequence word (unsigned)<br/>
  Byte 4 and 5:  Speed (unsigned)<br/> 
  ...<br/></em></p>
  
  <p>I would like to generate a table with 2 columns time and Speed</p>
  
  <p>My approch was to read the file once as a csv to get the timestamp column.</p>
  
  <pre><code>library(bit)
  dataPath="rawdata.txt"
  #to create time col read file as csv:
  rwch=read.csv(dataPath, sep=":")
  </code></pre>
  
  <p>And then read the file again as binary. 
  I split the file into 27 Byte pieces which is the length of a line. </p>
  
  <pre><code>#read binary
  to.read = file(path, "rb")
  rw=readBin(to.read, what="raw", n = 100*27, endian = "big")
  rws=split(rw, ceiling(seq_along(rw)/27))
  </code></pre>
  
  <p>But then I stuck. The resulting vector does not contain raw data and I’m not able to split it again in order to get the Speed out of it.
  I’ve tried several functions such as hexView ,readRaw but I’m not able to generate my list.</p>
  
  <p>I'm glad for any hint</p>