powered by
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)
A vector of the same type as the initial vector with the values within each block reversed.
vector. Usually a raw vector, but can be any type
block size. Usually a power of 2.
Other data permutation functions: aperm_array_to_vector(), aperm_vector_to_array()
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)
Run the code above in your browser using DataLab