# NOT RUN {
is_even <- function(x) x %% 2 == 0
3:10 %>% detect(is_even)
3:10 %>% detect_index(is_even)
3:10 %>% detect(is_even, .right = TRUE)
3:10 %>% detect_index(is_even, .right = TRUE)
# Since `.f` is passed to as_mapper(), you can supply a
# lambda-formula or a pluck object:
x <- list(
list(1, foo = FALSE),
list(2, foo = TRUE),
list(3, foo = TRUE)
)
detect(x, "foo")
detect_index(x, "foo")
# }
Run the code above in your browser using DataLab