VOOZH about

URL: https://www.geeksforgeeks.org/r-language/how-to-create-array-using-given-columns-rows-and-tables-in-r/

⇱ How to create array using given columns, rows, and tables in R ? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to create array using given columns, rows, and tables in R ?

Last Updated : 24 Sep, 2021

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


 

Comment
Article Tags:

Explore