Write a R program to create a matrix taking a given vector of numbers as input. Display the matrix.
M = matrix(c(1:16), nrow = 4, byrow = TRUE) print("Original Matrix:") print(M)
Sample Output:
[1] "Original Matrix:" [,1] [,2] [,3] [,4] [1,] 1 2 3 4 [2,] 5 6 7 8 [3,] 9 10 11 12 [4,] 13 14 15 16
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
[1] "Original Matrix:" [,1] [,2] [,3] [,4] [1,] 1 2 3 4 [2,] 5 6 7 8 [3,] 9 10 11 12 [4,] 13 14 15 16need an explanation for this answer? contact us directly to get an explanation for this answer