Predicate

Guards! Guards! purrr::map_if

I found a cool use for purrr’s map_if function recently that both felt wizardly and helped me better understand when to use map_if. Problem: I had a list called params with 3 items of different types start_date - a Date end_date - a Date confidence_interval - a Numeric params <- list( start_date = as.Date("2015-01-01"), end_date = as.Date("2015-12-31"), confidence_interval = 0.8 ) params ## $start_date ## [1] "2015-01-01" ## ## $end_date ## [1] "2015-12-31" ## ## $confidence_interval ## [1] 0.