ComeçarComece de graça

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

Este exercício faz parte do curso

Programming with dplyr

Ver curso

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Rows with less than 0 for any "perc_change" ending columns
imf_data %>%
  filter(___(.cols = ___, 
             .fns = ~ ___) %>% 
  select(country, year, ends_with("perc_change"))
Editar e executar o código