title: what is the equivalent of Matlab's typecast function in R / Python / Julia
body: <p>what is the equivalent of Matlab's <code>typecast</code> function in R? in Python? in Julia? The description of Matlab's typecast function is given here: <a href="http://www.mathworks.com/help/matlab/ref/typecast.html" rel="nofollow">typecast</a></p>
  
  <p>Example, in Matlab</p>
  
  <pre><code>X = uint32([1 255 256])
  X =
             1         255         256
  
  Y = typecast(X, 'uint8') # little endian
  Y =
     1   0   0   0  255   0   0   0   0   1   0   0
  </code></pre>
  
  <p>Thanks</p>
  
  <p>Please note: I am not looking for the R / Python / Julia equivalent of Matlab's <code>cast</code> function (for instance I'm not looking for <code>as.integer</code>, <code>as.character</code> in R)</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Thanks for the answers for Julia / R / Python. StackOverflow allows me to select one answer, but I up voted all the answers. </p>