Question: I would like you to write a function that takes the following matrix X = and multiplies each pair of numbers in the columns together
I would like you to write a function that takes the following matrix X = and multiplies each pair of numbers in the columns together and adds the products up (i.e. 1*10 + 2*9 + ... + 10*1). The function you are creating can be used to calculate the inner product of two vectors which is necessary for a lot of calculations using ANOVA contrast variables. Assuming the function is called something like innerProductCalc, you would send the matrix to the function as innerProductCalc(X) Submit your code and the results from R Console.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
