BaşlayınÜcretsiz Başlayın

Filtering for one country and one year

You can also use the filter() verb to set two conditions, which could retrieve a single observation.

Just like in the last exercise, you can do this in two lines of code, starting with gapminder %>% and having the filter() on the second line. Keeping one verb on each line helps keep the code readable. Note that each time, you'll put the pipe %>% at the end of the first line (like gapminder %>%); putting the pipe at the beginning of the second line will throw an error.

Bu egzersiz

Introduction to the Tidyverse

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Filter the gapminder data to retrieve only the observation from China in the year 2002.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

library(gapminder)
library(dplyr)

# Filter for China in 2002
Kodu Düzenle ve Çalıştır