flip_endian | R Documentation |
This will create a new vector with the values reversed within the given block size. This can be used for changing the endianness of a set of values
flip_endian(x, size)
x |
vector. Usually a raw vector, but can be any type |
size |
block size. Usually a power of 2. |
A vector of the same type as the initial vector with the values within each block reversed.
Other data permutation functions:
aperm_array_to_vector()
,
aperm_vector_to_array()
vec <- c(1, 2, 3, 4)
flip_endian(vec, 1) # should give: c(1, 2, 3, 4)
flip_endian(vec, 2) # should give: c(2, 1, 4, 3)
flip_endian(vec, 4) # should give: c(4, 3, 2, 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.