![]() |
VOOZH | about |
In this article, we will discuss how to create an array using given columns, rows, and tables in R Programming Language. The array is created using the array() function.
Syntax: Array(vector.., dim=c(row, columns, tables))
Parameter:
- x: vector
- dim: values used to create array
Example 1: Creating a simple array with 2 rows, 3 columns, 1 table
The below example will create an array of 3x3 matrices with 1 table.
Output:
[,1] [,2] [,3] [1,] 0 2 4 [2,] 1 3 5
The above array is created with 2 rows and 3 columns.
Example 2: Creating an array using 3 rows, 3 columns, and 2 tables.
Here we will create an array with 3 rows, 3 columns, and 2 tables.
Output:
👁 Image