R STUDIO The R file will consist of all the code and should be executable (you should use R script). Copy your R script into
R STUDIO
The R file will consist of all the code and should be executable (you should use R script).
Copy your R script into a word document, submit both R, and word (doc/docx) files.
All the answers, other than the actual codes, are to be noted as comments
Name the file LastName_Assignment1 with appropriate file extension (.doc and .R)
Your script should follow the format below:
#1 Basic operations, assignments
#a
x <- 4
y <- 5
z <- x+y
z
#output: 9
#b
x <- 1
y <- 5
z <- x+y
z
Question 1: Matrices
a. Provide the code to create matrix X
X = 2 5 8
3 6 9
4 7 10
b. Provide the code to assign the value 2 for all the elements in the matrix that are less than 5
c. Assign the values in 2nd and 3rd column to the new matrix Y
d. Assign row names of X as R1, R2, R3
e. Assign column names of X as C1 to C3
f. Add a new row named R4 with the following values of 3, 6, 9
g. Add a new column named C4 with the following values of 1,3,5,7
h. Assign 0s for all elements of the second column C2
i. Print the final X matrix
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started