Q:

Write a R program to list the distinct values in a vector from a given vector

0

Write a R program to list the distinct values in a vector from a given vector.

All Answers

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

v = c(10, 10, 10, 20, 30, 40, 40, 40, 50)
print("Original vector:")
print(v)
print("Distinct values of the said vector:")
print(unique(v))

Sample Output:

[1] "Original vector:"
[1] 10 10 10 20 30 40 40 40 50
[1] "Distinct values of the said vector:"
[1] 10 20 30 40 50

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