You are on page 1of 1

Matrix, Array and Factors Practice Questions

1.

- Create a 2 by 4 matrix with the following number 4,3,5,5,12,43,88,10


- Arrange the numbers of the matrix row wise
- Add another row with the following numbers 5, 4, 3, 2
- Add another column with the following number 41,55,62
- Give row names and column names to the matrix
- Access the number on the 1st row and 4th column
- Access the 3rd row
- Access the 2nd column
- Remove the 1st row
- Remove the 3rd column
2. Create a matrix containing of a sample of 10 numbers between 1 to 20 with 2 rows.
3. Create an array with the following vectors
R1<- c(77,66)
R2<- c(22,12,67,34,54,12)
Containing 4 rows, 2 columns and 3 matrices
Assign names for rows, columns and matrix
4. Create an array consisting of the sample of 15 numbers from the sequence of 20 to 50,
also containing 4 rows, 2 columns and 3 matrices and assign suitable names for rows,
columns and matrices
Access the element of 3rd row, 2nd column and 2nd matrix
Access the 1st row in the third matrix
Access the 2nd column in the first matrix
Access only the first matrix
Multiply the 2nd row of the 1st matrix and the 3 row of the 3rd matrix
Divide the elements on the second row second column 2nd matrix with the elements
of the second row first column third matrix
Ensure that the result is an array
Add the second and third matrix
5. Create a vector and store the following T-Shirt sizes in – L,M,S,M,M,S,L,XL,XL,L,L
Convert the character vector into a factor
Order it as per increasing sizes
Attach new names for the levels as T_L, T_S etc

Check if the second element in the factor is greater than the first element

You might also like