Create following two matrices A and B with following elements.
A=,B=
Write R commands to do the following tasks:
(i) Multiply the two matrices.
(ii) Combine the two matrices row-wise.
(iii) Create a function that computes the following expression:
A 2+3*B
| X | Y | Z | W |
| 0.04 | 0.16 | 0.53 | A |
| 0.82 | 0.87 | 0.84 | A |
| 0.32 | 0.65 | 0.99 | A |
| 0.39 | 0.83 | 0.42 | A |
| 0.31 | 0.93 | 0.78 | A |
| 0.83 | 0.31 | 0.41 | A |
| 0.73 | 0.74 | 0.88 | A |
| 0.32 | 0.39 | 0.50 | B |
| 0.60 | 0.85 | 0.68 | B |
| 0.65 | 0.28 | 0.86 | B |
| 0.55 | 0.95 | 0.77 | B |
| 0.53 | 0.35 | 0.32 | B |
| 0.91 | 0.01 | 0.91 | B |
| 0.84 | 0.61 | 0.37 | B |
Write R commands to:
(i) Compute the group wise means of x, y and z according to the groups
defined by w column using apply family function.
(ii) Sort RData according the y column of it.
To perform the tasks outlined in the question using R, you can follow these steps:
1. Create Matrices A and B:
# Create matrices A and B
A <- matrix(c(1, 2, 0, 1), nrow = 2, ncol = 2, byrow = TRUE)
B <- matrix(c(-3, 1, 2, -1), nrow = 2, ncol = 2, byrow = TRUE)
2. Multiply the ________ ________ _________ ___ ______ _____ __________ _________ _________ _____.
___ _____ ________ _______ ___ ______ _______ __________ _____ _______ __________.
___ ____ ________ ______ ____ _____.
_______ ________ _______ __________ _______ _____ _____.
___ ________ _____ ____ ____ __________.
______ ________ ________ _____ _______ ________ ____ _____ _____.
_____ ____ _________ ________ ____ ___ ________ _____ __________.
______ ________ ________ ________ ____ _____ _____ _________ ______ ______ _____ ______.
____ _______ ____ __________ ________ ___ _________ ________ _____.
__________ ______ ____ _______ ___ __________ _____ ______ ________ ______ ______.
_________ ___ _____ _____ ___ ____ _____ ______ _________ __________ _______ _________.
__________ ___ _______ _____ ______ ____ __________.
___ _____ _____ ____ ______.
__________ ______ ___ _______ ______ _________ ____ ________ _________ __________.
______ _________ _______ _____ _______ ____ _________ __________ _________.
_____ _______ _________ _____ ________ ___ ________ _________ ______ _____ _______ _____.
_______ _________ ________ _________ ________.
_____ _______ _____ ___ __________ ________ ____.
___ ____ _________ ____ __________ ____ ___.
_____ _______ ___ ________ _____.
____ ___ _____ _____ ________ ________ ________ _____.
_________ _____ __________ ________ _______ _____ ____.
_______ _______ _________ ______ _________ ________ ___ ___ ______ ___ ________.
___ ___ ______ _____ __________ ___ _________ ______ ______ ______ __________.
______ ___ _____ __________ ______ _________ ________ ____.
_________ ________ __________ ________ __________ ____ ____ ___ ___ __________.
_______ ________ ______ __________ _________ _________ _________.
___ _______ ________ ____ ________ __________ ______ ______ ________ _________ _____ __________.
_______ ______ _______ _________ _______ _______ __________ _________ _____ ______.
_______ _____ ________ ____ ___ ____ _______ _________ ____ _______ _______.
___ ________ _______ ______ _____.
____ ___ ____ ___ ____ ___ __________ _____ _________.
_______ ___ ____ _____ ________ __________ ____ __________ _______ _______ ______.
_____ ________ _______ ______ _______ _________ _______.
__________ _________ ________ ______ _________ ________ ________.
______ ___ ______ ____ _______ ____ _________.
Get Full Answer on WhatsApp