Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

R Programming: Create an array using four given columns, three given rows, and two given tables and display the content of the array

R Programming: Array Exercise-6 with Solution

Write a R program to create an array using four given columns,three given rows,and two given tables and display the content of the array.

Sample Solution :

R Programming Code :

array1 =  array(1:30, dim=c(3,5,2))
print(array1)

Sample Output:

, , 1

     [,1] [,2] [,3] [,4] [,5]
[1,]    1    4    7   10   13
[2,]    2    5    8   11   14
[3,]    3    6    9   12   15

, , 2

     [,1] [,2] [,3] [,4] [,5]
[1,]   16   19   22   25   28
[2,]   17   20   23   26   29
[3,]   18   21   24   27   30                         

R Programming Code Editor:



Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a R program to combine three arrays so that the first row of the first array is followed by the first row of the second array and then first row of the third array.
Next: Write a R program to create a two-dimensional 5×3 array of sequence of even integers greater than 50.

Test your Programming skills with w3resource's quiz.

What is the difficulty level of this exercise?