Question: 9 . Create a 1 0 0 0 0 0 by 1 0 matrix with the numbers 1 : 1 0 0 0 0 0
Create a by matrix with the numbers : Make a forloop that calculates the sum for
each row of the matrix and stores the results in a list rowAdd Verify that your results are consistent with
what you obtain with the apply function to calculate row sums as well as with the builtin rowSums function.
Side Note: In R always preallocate your vectors and update the values instead of creating an empty vector
and appending to it which is a significantly slower operation.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
