Page 1 of 1

Answer only in R coding language, please. Thank you Q1. Write a function margin_index_power() that takes as input a matr

Posted: Thu May 05, 2022 12:43 pm
by answerhappygod
Answer only in R coding language, please. Thank you
Q1. Write a function margin_index_power() that takes as input a
matrix A and an argument rows, TRUE/FALSE with a default value of
TRUE. margin_index_power(A, rows = TRUE) outputs the matrix A with
the elements in the ith row of A taken to the ith power. If rows =
FALSE, then do the same but with the columns instead of rows of
A.
Please test your function on the following test inputs in your
submission:
Q2.
Write a function is_anti_diagonal() that takes as
input a matrix A and outputs TRUE if it is
anti-diagonal and FALSE otherwise. While you can
assume A is a matrix, you cannot assume that it is
square.
Q3.
Write a function called set_border_NA() that takes as
input a matrix A and outputs A with its borders
set to NA. If A has exactly one row or exactly one
column, throw an error of your choosing.