1.

_____________ function is preferred over sapply as vapply allows the programmer to specific the output type.(a) Lapply(b) Japply(c) Vapply(d) ZapplyI got this question at a job interview.This interesting question is from Functions topic in section Control Structures, Functions, Scoping Rules, Loop Functions and Debugging of R Programming

Answer» RIGHT choice is (c) Vapply

Best EXPLANATION: Vapply is similar to SAPPLY, but has a pre-specified type of RETURN value, so it can be safer (and SOMETIMES faster) to use. simplify2array() is the utility called from sapply() when simplify is not false and is similarly called from mapply().


Discussion

No Comment Found

Related InterviewSolutions