Question: Write R code(s) (which is R programming codes) to create a numeric vector with 3 items 1, 2, and 3. The first item 1 has
Write R code(s) (which is R programming codes) to create a numeric vector with 3 items 1, 2, and 3. The first item 1 has name one, the second item has name two, the third item has name three.
6. Write R code(s) to create the following matrix called counts.
| Mon | Tue | Wed | |
| Adam | 1 | 2 | 3 |
| Bell | 4 | 5 | 6 |
| Coach | 7 | 8 | 9 |
7. Using the matrix counts created in question 7, write R code(s) to a. retrieve the count for Bell on Wed. b. retrieve the counts for Coach c. retrieve the counts on Mon
8. Write codes to add another row of data to the matrix counts created in question 7. The final matrix should looks like the one below.
| Mon | Tue | Wed | |
| Adam | 1 | 2 | 3 |
| Bell | 4 | 5 | 6 |
| Coach | 7 | 8 | 9 |
| Dell | 10 | 11 | 12 |
9. Write codes to add another column of data to the matrix counts created in question 7. The final matrix looks like below.
| Mon | Tue | Wed | Thur | |
| Adam | 1 | 2 | 3 | 10 |
| Bell | 4 | 5 | 6 | 11 |
| Coach | 7 | 8 | 9 | 12 |
10. Write R code(s) to: a. Create a matrix calledamatrix that looks like the one below.
| [,1] | [,2] | [,3] | |
| [1,] | 1 | 4 | 7 |
| [2,] | 2 | 5 | 8 |
| [3,] | 3 | 6 | 9 |
b. Create a matrix calledbmatrix that looks like the one below.
| [,1] | [,2] | [,3] | |
| [1,] | 1 | 2 | 3 |
| [2,] | 4 | 5 | 6 |
| [3,] | 7 | 8 | 9 |
c. Transpose amatrix. d. Calculate the inner multiplication of amatrix and bmatrix. e. Find the inverse of the element-wise products of amatrix andbmatrix.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
