aperm_vector_to_array | R Documentation |
Permute a linear vector of data into an R array
aperm_vector_to_array(x, src, flipy = FALSE, simplify_matrix = TRUE)
x |
vector |
src |
Specification of source dimensions in the order of presentation
in the source data. This must a named integer vector with
the names "planes", "rows", "cols" (and their corresponding sizes)
in the order in which they occur in the data. The first
named element must always be "planes". Use |
flipy |
flip the array vertically. Default: FALSE |
simplify_matrix |
If the resulting array only has a single plane, should this be simplified to a matrix? Default: TRUE |
array or matrix
Other data permutation functions:
aperm_array_to_vector()
,
flip_endian()
# Convert a vector of packed RGB data to an array with 3 planes
x <- c(
'r0', 'g0', 'b0', 'r1', 'g1', 'b1', 'r2', 'g2', 'b2',
'r3', 'g3', 'b3', 'r4', 'g4', 'b4', 'r5', 'g5', 'b5'
)
aperm_vector_to_array(x, src = c(planes = 3, cols = 3, rows = 2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.