Q:

Write a R program to find second highest value in a given vector

0

Write a R program to find second highest value in a given vector.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

x = c(10, 20, 30, 20, 20, 25, 9, 26)
print("Original Vectors:")
print(x)
print("Find second highest value in a given vector:")
l = length(x)
print(sort(x, partial = l-1)[l-1])

Sample Output:

[1] "Original Vectors:"
[1] 10 20 30 20 20 25  9 26
[1] "Find second highest value in a given vector:"
[1] 26

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now