array_: Fast in-place transformation to an array (without copy)

Description Usage Arguments Value Note See Also

View source: R/array_transform.R

Description

array_ transforms its data argument to an array by reference. No copy is made at all, and it invisibly returns the array.

Usage

1
array_(x, dim, dimnames = NULL, force_length = TRUE, arg_check = TRUE)

Arguments

x

a data vector, matrix or array

dim

the dim attribute for the array to be created, that is an integer vector of length one or more giving the maximal indices in each dimension

dimnames

either NULL or the names for the dimensions. This must a list (or it will throw an error) with one component for each dimension, either NULL or a character vector of the length given by dim for that dimension. The list can be named, and the list names will be used as names for the dimensions. If the list is shorter than the number of dimensions, it is extended by NULLs to the length required.

force_length

logical. If TRUE (the default), array_ checks if length(x)==nrow*ncol. If not, x is recycled or subsetted to the desired length.

arg_check

logical indicating if argument checks should be performed (TRUE, the default). Do not set to FALSE unless you really know what you are doing!

Value

This function (invisibly) returns an array (or a matrix if length(dim)==2L) without duplicating the input values.

Note

Use array_ with extra care because it modifies in place all objects which x refers to. See matrix_ for further hints.

See Also

matrix_ for in-place transformation of x to a matrix (without copy) and array for creating a new array without modifying the original input


tdeenes/eegR documentation built on April 19, 2021, 4:17 p.m.