Exercise: Select by indices

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

Output
# 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.

Output

Submit code to see output here.

Select columns from a data frame