Aan de slagGa gratis aan de slag

Filtering and arranging

You'll often need to use the pipe operator (%>%) to combine multiple dplyr verbs in a row. In this case, you'll combine a filter() with an arrange() to find the highest population countries in a particular year.

Deze oefening maakt deel uit van de cursus

Introduction to the Tidyverse

Cursus bekijken

Oefeninstructies

  • Use filter() to extract observations from just the year 1957, then use arrange() to sort in descending order of population (pop).

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

library(gapminder)
library(dplyr)

# Filter for the year 1957, then arrange in descending order of population


Code bewerken en uitvoeren