Question: in R. (25 points) Write a function Tran() which input a matrix X as an argument, and output a new matrix Y based on the

in R. (25 points) Write a function Tran() which input a matrixin R.

(25 points) Write a function Tran() which input a matrix X as an argument, and output a new matrix Y based on the rule: If an element of X is an even number, Y keeps the same value; if an element of X is a odd number, Y doubles it. For example: 15 4 9 X = 14 3 6 2 8 23 Y = (10 4 18 4 6 6 2 8 46 a) Call the Tran() function you created to transform the following matrix TT. Print the output. 10 11 661 TT = 57 18 35 1 35 19

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!