| rray_split | R Documentation |
rray_split() divides x into contiguous arrays along an axis.
Using rray_combine() along the same axis reconstructs x.
rray_split(x, ..., axis, dimensions)
x |
An array. |
... |
These dots are for future extensions and must be empty. |
axis |
The axis to split along, given by position or by title. |
dimensions |
One of:
|
A list of arrays each with the same dimensions as x, except along axis.
x <- array(1:12, c(6, 2))
# Three arrays of two rows
rray_split(x, axis = 1, dimensions = 2)
# Arrays of one and five rows
rray_split(x, axis = 1, dimensions = c(1, 5))
# One array per column
rray_split(x, axis = 2, dimensions = 1)
# One array per column, by title
y <- rray_set_titles(x, c("row", "col"))
rray_split(y, axis = "col", dimensions = 1)
# Arrays of dimension zero are allowed in the explicit form
rray_split(x, axis = 2, dimensions = c(0, 2))
# Splitting and combining along the same axis are inverses
rray_combine(!!!rray_split(x, axis = 1, dimensions = 3), .axis = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.