1.

How will you check if an element is present in a vector?(a) Match()(b) Dismatch()(c) Mismatch()(d) Search()The question was asked in an interview for internship.I need to ask this question from Functions topic in portion Control Structures, Functions, Scoping Rules, Loop Functions and Debugging of R Programming

Answer»

Correct choice is (a) MATCH()

The explanation: It can be done using the match () function- match () function returns the first APPEARANCE of a particular element. The other way is to use %in% which returns a BOOLEAN VALUE either true or FALSE.



Discussion

No Comment Found

Related InterviewSolutions