ComeçarComece de graça

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?

Este exercício faz parte do curso

Intermediate Functional Programming with purrr

Ver curso

Exercício interativo prático

Transforme a teoria em ação com um de nossos exercícios interativos

Começar o exercício