Question: 20. A vector 'z' is defined as: z = [9.6, -8.41, -0.07, 4.87, -4.72, 1.94, 6.66, -1.04, 3.44, -4.97, 4.36, -7.25] Which of the following
20. A vector 'z' is defined as: z = [9.6, -8.41, -0.07, 4.87, -4.72, 1.94, 6.66, -1.04, 3.44, -4.97, 4.36, -7.25] Which of the following R codes will calculate the sum of these values with its absolute greater than 5? a. Sum <- 0 For (I in 1:length(z)){ If(abs(z[i]) >5) { Sum <- sum 1 } } b. Sum <- 0 For (I in 1:5){ If(abs(z[i]) >5) { Sum <- sum z[i] } } c. Sum <- 0 For (I in 1:length(z)){ If(abs(z[i]) >5) { Sum <- sum z[i] } } d. Sum <- 0 For (I in 1:length(z)){ If(z[i]) >5) { Sum <- sum 1 } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
