Nothing
#' Stack arrays along a new axis
#'
#' @description
#' `rray_stack()` joins arrays along a new axis inserted at `.axis`. All
#' preexisting axes are broadcast to their common dimension.
#'
#' The new axis has a dimension equal to the number of arrays you are stacking.
#'
#' @details
#' This function participates in rray's
#' [common name determination rules][faq-common-names] on every existing axis.
#' Names of `...` become the names of the new axis.
#'
#' @param ... Arrays to stack.
#'
#' @param .axis The axis to stack along, given
#' [by position in the output][faq-axes]. Must be between 1 and one greater
#' than the maximum dimensionality of the input arrays. For example, you can
#' stack 2D matrices along axis 3, but not axis 4.
#'
#' @returns
#' An array with the following dimensions:
#' - Along `.axis`, the number of inputs.
#' - Along all other axes, the common dimensions of the inputs taken via
#' broadcasting.
#'
#' @seealso [rray_unstack()], [rray_combine()]
#'
#' @export
#' @examples
#' x <- array(1:12, c(3, 4))
#' y <- array(13:24, c(3, 4))
#'
#' # (3, 4) -> (2, 3, 4)
#' rray_dimensions(rray_stack(x, y, .axis = 1))
#'
#' # (3, 4) -> (3, 4, 2)
#' rray_stack(x, y, .axis = 3)
#'
#' # Existing axes are broadcast
#' # (3, 1) and (3, 4) -> (2, 3, 4)
#' a <- array(1:3, c(3, 1))
#' b <- array(1:12, c(3, 4))
#' rray_dimensions(rray_stack(a, b, .axis = 1))
#'
#' # Names of `...` name the new axis
#' rray_stack(first = 1:2, second = 3:4, .axis = 2)
rray_stack <- function(..., .axis) {
.Call(ffi_rray_stack, list2(...), .axis, environment())
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.