# R Programming Matrix: Exercises, Practice, Solution

## R Programming Matrix [13 exercises with solution]

[** An editor is available at the bottom of the page to write and execute the scripts.** Go to the editor]

**1.** Write a R program to create a blank matrix.

Click me to see the sample solution

**2.** Write a R program to create a matrix taking a given vector of numbers as input. Display the matrix.

Click me to see the sample solution

**3.** Write a R program to create a matrix taking a given vector of numbers as input and define the column and row names. Display the matrix.

Click me to see the sample solution

**4.** Write a R program to access the element at 3^{rd} column and 2^{nd} row, only the 3^{rd} row and only the 4^{th} column of a given matrix.

Click me to see the sample solution

**5.** Write a R program to create two 2x3 matrix and add, subtract, multiply and divide the matrixes.

Click me to see the sample solution

**6.** Write a R program to create a matrix from a list of given vectors.

Click me to see the sample solution

**7.** Write a R program to extract the submatrix whose rows have column value > 7 from a given matrix.

Click me to see the sample solution

**8.** Write a R program to convert a matrix to a 1 dimensional array.

Click me to see the sample solution

**9.** Write a R program to create a correlation matrix from a dataframe of same data type.

Click me to see the sample solution

**10.** Write a R program to convert a given matrix to a list of column-vectors.

Click me to see the sample solution

**11.** Write a R program to find row and column index of maximum and minimum value in a given matrix.

Click me to see the sample solution

**12.** Write a R program to rotate a given matrix 90 degree clockwise rotation.

Click me to see the sample solution

**13.** Write a R program to concatenate two given matrices of same column but different rows.

Click me to see the sample solution

**R Programming Code Editor:**

**More to Come !**

**Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.**

**Weekly Trends and Language Statistics**- Weekly Trends and Language Statistics