Q:

Write a R program to find the levels of factor of a given vector

0

Write a R program to find the levels of factor of a given vector.

All Answers

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

v = c(1, 2, 3, 3, 4, NA, 3, 2, 4, 5, NA, 5)
print("Original vector:")
print(v)
print("Levels of factor of the said vector:")
print(levels(factor(v)))

Sample Output:

[1] "Original vector:"
 [1]  1  2  3  3  4 NA  3  2  4  5 NA  5
[1] "Levels of factor of the said vector:"
[1] "1" "2" "3" "4" "5"

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