Arranging observations by life expectancy
You use arrange() to sort observations in ascending or descending order of a particular variable. In this case, you'll sort the dataset based on the lifeExp variable.
Deze oefening maakt deel uit van de cursus
Introduction to the Tidyverse
Oefeninstructies
- Sort the
gapminderdataset in ascending order of life expectancy (lifeExp). - Sort the
gapminderdataset in descending order of life expectancy.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
library(gapminder)
library(dplyr)
# Sort in ascending order of lifeExp
# Sort in descending order of lifeExp