One for any, one for all
You can use the if_any() and if_all() functions with select() helper verbs to check for conditions being met across any or all columns. You'll again work with imf_data to return different subsets of rows according to different numeric conditions. Here you will focus on looking for years in which imports and exports increased or decreased from the previous year.
Recall the between() function in dplyr can be useful for specifying a range of values (from one to another).
Acest exercițiu face parte din cursul
Programming with dplyr
Exercițiu interactiv practic
Încearcă acest exercițiu completând acest cod de exemplu.
# Rows with less than 0 for any "perc_change" ending columns
imf_data %>%
filter(___(.cols = ___,
.fns = ~ ___) %>%
select(country, year, ends_with("perc_change"))