Home basic programing in r hackerrank R Basics-17 -Coding- Factors and Levels-2 (Hands On) - ClassiCoder Factors and LevelsPerform the following tasks:1. Find the factor of the vector V passed as function arguments and assign the number of levels to the variable ans.2. Note: Function Structure is given as an unalterable codeFactor-And-LeveIs-2-R-BasicFactor-And-LeveIs-2-R-Basic-Solution
1 comment
Correct one is:
ans<-length(levels(factor(V)))