datacamp-logo

What is a predicate?

A predicate function is "a function that either returns TRUE or FALSE." While a predicate functional "takes a vector and a predicate function and do something useful."***

In other words, the predicate functionals take in .x, which is a vector, a dataframe, or a list, and test the predicate on every element of .x. For example, you can test if every element is numeric with the is.numeric() predicate from R-Base, or if the mean of some elements is under 5 with this mapper: ~mean(.x) < 5.

Which of these functions is NOT a predicate?

Answer the question
50 XP
Possible Answers
  • press
  • press
  • press
  • press