Skip to contents

Create an R array without having to wrap data in c()

Usage

arr(..., shape = NULL)

Arguments

...

(any)
Values of new array.

shape

(NULL | integer())
Shape of new array. If NULL (default), uses length of elements to create a 1D array.

Examples

arr(1, 2, 3)
#> [1] 1 2 3
arr(1, 2, 3, 4, shape = c(2, 2))
#>      [,1] [,2]
#> [1,]    1    3
#> [2,]    2    4