How to create an array from vectors in R ?
In this article, we will discuss how to create an array from the vectors in R Programming Language. We can create an array using array() function. We have to pass the vectors and dim() as parameters. Here dim() function is used to give dimensions for the array.
array_name = array( c(vector 1 , vector 2 , . . . , vector n) , dim=c( no.of rows , no.of columns , no.of arrays ))
The approach is straightforward first we need to create vectors and then pass them to the array() function to create one. Implementation is given below:
Example 1 :
Example 2 :
Example 3 :