Exploring data with predicates
We will continue our exploration of A/B test data. Your manager is not interested in which days reached the threshold, he wants to know if every day reached the threshold or if some days reached the threshold. We'll use purrr
predicates to answer these questions.
You have received several thresholds and decided to write a script that will start with this threshold definition, and answer, for each design, if all the days have reached the threshold, and if not, if some did.
The results from this A/B test are in the all_visits
list.
Este ejercicio forma parte del curso
Intermediate Functional Programming with purrr
Instrucciones del ejercicio
- Create a variable called
threshold
, that contains the number 160. - Create a new mapper, that will test if
.x
is overthreshold
. - Combine
map()
andevery()
to test if all elements are over the threshold. - Combine
map()
andsome()
to test if some elements are over the threshold.
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
# Create a threshold variable, set it to 160
# Create a mapper that tests if .x is over the defined threshold
over_threshold <- ___(~ .x > ___)
# Are all elements in every all_visits vectors over the defined threshold?
map(all_visits, ~ ___(.x, ___))
# Are some elements in every all_visits vectors over the defined threshold?
map(all_visits, ~ ___(.x, ___))