Question: Exercise 2. Describe mathematically what the following code does. Add comments to each line describing what each line accomplishes. Design a scenario where this code

Exercise 2. Describe mathematically what the following code does. Add comments to each line describing what each line accomplishes. Design a scenario where this code would be useful and write that scenario in R. (The scenario should not involve more than four lines of R code) OpSp = function(y, x) { n = length (y) s=n - 1 xs = sort (x) ci = rep(0, s) ssri = rep(0, s) for (i in 1:s) { ci [i] = (xs[i] + xs [i+1])/2 y1 = y [x
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
