We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Firefox.

Exercise: Select by indices

The gapminder_europe_2007 dataset contains economic and demographic information about European countries for the year 2007.

# A tibble: 30 x 6
  country continent  year lifeExp      pop gdpPercap
  <fct>   <fct>     <int>   <dbl>    <int>     <dbl>
1 Albania Europe     2007    76.4  3600523     5937.
2 Austria Europe     2007    79.8  8199783    36126.
3 Belgium Europe     2007    79.4 10392226    33693.
# … with 27 more rows

Create a subset of the dataset and compare the GDP per capita of the European countries for the year 2007:

  1. Apply the select() function on the gapminder_europe_2007 tibble.
  2. Keep the columns country and gdpPercap, but use only the index of the columns (1and 6) for this step.

Note that the dplyr package is already loaded.


Submit code to see output here.