Question

Following is a preview of the matrix x: Code: [,1] [,2] [,3] [1,] 1 3 5...

Following is a preview of the matrix x:

Code:

     [,1] [,2] [,3]
[1,]    1    3    5
[2,]    2    4    6

Write the code that return the output:

     [,1] [,2] [,3]
[1,]    1    3    5
[2,]    2    4    6
[3,]    7    8    9

Homework Answers

Answer #1

Adding row to the matrix in R:

# adding row to matrix
# taking given matrix
mat1=matrix(c(1:6),nrow=2,ncol=3,byrow=FALSE)
print(mat1)
# here rbind() will combine vectors.Here we are combining vector [7 8 9] to the original matrix
mat2=rbind(mat1,c(7:9))
print(mat2)

output:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
C++ Code! Represent the following matrix using a two-dimensional array and write a nested for loop...
C++ Code! Represent the following matrix using a two-dimensional array and write a nested for loop to initialize the elements (do not initialize the array in the declaration): 10  9   8 7   6   5 4 3   2
2. Write the output matrix “v” t = [2:4]; k = [1:3]; v = t.*k –...
2. Write the output matrix “v” t = [2:4]; k = [1:3]; v = t.*k – k.^2 4. Given: D = [1 2 3 4 5 6 7 8 9] (3x3) . Which command will extract the submatrix [1 2 3 4 5 6] (2x3) ? a. D[1:2,1:3] b. D(1,2 ;1,3) c. [D(1:2),D(1:3)] d. D(1:2,1:3) 14. What will be the dimension of matrix B? B=[ones(3) zeros(3) rand(3); 2*eye(9)] 18. Find the value of “C” A=1:2:10; B=linspace(1,5,5); C = length(A)*B(2)+A(5)*B(3); 19....
#2. For the matrix A =   1 2 1 2 3 7 4 7...
#2. For the matrix A =   1 2 1 2 3 7 4 7 9   find the following. (a) The null space N (A) and a basis for N (A). (b) The range space R(AT ) and a basis for R(AT ) . #3. Consider the vectors −→x =   k − 6 2k 1   and −→y =   2k 3 4  . Find the number k such that the vectors...
Consider the matrix A= −2−2 6] [−2−3 5] [3 4−8] [−7−9 18 (all one matrix) (a)...
Consider the matrix A= −2−2 6] [−2−3 5] [3 4−8] [−7−9 18 (all one matrix) (a) How many rows ofAcontain a pivot position? (b) Do the columns ofAspanR4? (c) Does the equationA ~x=~b have a solution for every~b∈R^4? (d) Would the equation A~x=~0 have a nontrivial solution? (e) Are the columns of A linearly independent? (~x is vector x)
3. Write the matrix in row-echelon form: 1 2 -1 3 3 7 -5 14 -2...
3. Write the matrix in row-echelon form: 1 2 -1 3 3 7 -5 14 -2 -1 -3 8
By Using Matlab Matcal (A, B) returns matrix A and B products, while printing the matrix...
By Using Matlab Matcal (A, B) returns matrix A and B products, while printing the matrix computation formula in outmat. txt file as follows. (The sizes of A and B are very variable. In other words, it shall be possible to perform operation for matrix operation of 2 x 2 size, and it shall also be possible to calculate and output for 100 X 100 matrix models. ) >> A = [1 23;4 56 ; 79] >> B = [0...
Refer to the following matrices. A = 1 −8 7 −3 −18 6 5 8 6...
Refer to the following matrices. A = 1 −8 7 −3 −18 6 5 8 6 0 5 8 3 4 8 −2     B = 4 −7 4 0 1 4 9 5 3 −3 0 9 C = 1 0 3 2 8     D = 1 9 −7 0 What is the size of each matrix? A     ____× ____ B     _____× _____ C     ____× ____ D     ____× _____
Write the code to return the output: Code: id <- c(5, 6, 7, 8, 9) prod...
Write the code to return the output: Code: id <- c(5, 6, 7, 8, 9) prod <- c("F", "H", "B", "S", "D") units <- c(12, 19, 44,26, 43) df <- data.frame(id, prod, units) Output must be: [1] 12 19 44 26 43
APPLIED STATISTICS 2 USE R CODE ! SHOW R CODE! Write a function to calculate the...
APPLIED STATISTICS 2 USE R CODE ! SHOW R CODE! Write a function to calculate the sum of cubes from 1 to n, but skip the multiple of 5. Say, if n=10, the result is 1^3+2^3+3^3+4^3+6^3+7^3+8^3+9^3. The input is the value of n, the output is the summation. (you need if statement to check whether a number is a multiple of 5.In R, a%%b is the remainder for a divided by b. So, we have 10%%5=0) APPLIED STATISTICS 2 USE...
n x n matrix A, where n >= 3. Select 3 statements from the invertible matrix...
n x n matrix A, where n >= 3. Select 3 statements from the invertible matrix theorem below and show that all 3 statements are true or false. Make sure to clearly explain and justify your work. A= -1 , 7, 9 7 , 7, 10 -3, -6, -4 The equation A has only the trivial solution. 5. The columns of A form a linearly independent set. 6. The linear transformation x → Ax is one-to-one. 7. The equation Ax...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT