Assignment 5: Arrays and Matrices in R programming
1. Write a R program to create an array of two 3x3 matrices
each with 3 rows and 3 columns from two given two vectors.
Answer:
2. Write a R program to create a blank matrix.
Answer :
3. Write a R program to create a matrix taking a given
vector of numbers as input. Display the matrix.
Answer :
4. Write a R program to create a two-dimensional 5x3 array
of sequence of even integers greater than 50.
Answer :
5. Write a R program to convert a given matrix to a 1
dimensional array.
Answer :
SET A:
1. Write a R program to create a matrix taking a given
vector of numbers as input. Display the matrix.
Answer :
2. 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.
Answer :
3. Write a R program to access the element at 3rd column and
2nd row, only the 3rd row and only the 4th column of a given matrix.
Answer :
4. Write an R program to create three vectors a,b,c with 3
integers. Combine the three vectors to become a 3×3 matrix where each column
represents a vector. Print the content of the matrix.
Answer:
5. Write an R program to create a list of elements using
vectors, matrices and a functions. Print the content of the list.
Answer :
SET B:
1. Write a R program to create an array of three 3x2
matrices each with 3 rows and 2 columns from two given two vectors of different
length.
Answer :
2. Write a R program to create an array of two 3x3 matrices
each with 3 rows and 3 columns from two given two vectors. Print the second row
of the second matrix of the array and the element in the 3rd row and 3rd column
of the 1st matrix.
Answer :
3. Write a R program to access the element at 3rd column and
2nd row, only the 3rd row and only the 4th column of a given matrix.
Answer :
4. Write a R program
to create two 2x3 matrices and add, subtract, multiply and divide the matrix
elements.
Answer :
5. Write an R program to convert a given matrix to a list
and print list in ascending order.
Answer :
SET C:
1. 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.
Answer :
2. Write a R program to find row and column index of maximum
and minimum value in a given matrix.
Answer :
No comments:
Post a Comment