Exercise

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).

Instructions 1/2

undefined XP
  • 1
    • Choose rows with negative values in any column names ending with "perc_change".
  • 2
    • Choose rows where both import and export percentages have remained stable from the previous year (between -1% and 1%).