Dört fiil arasından seçim yapmak
Bu bölümde dört fiili öğrendin: select(), mutate(), relocate() ve rename(). Burada, her durum için uygun fiili seçeceksin. Parantezlerin içindeki hiçbir şeyi değiştirmen gerekmeyecek.
Bu egzersiz
dplyr ile Veri Manipülasyonu
kursunun bir parçasıdırEgzersiz talimatları
unemploymentsütununun adınıunemployment_rateolarak değiştirmek için doğru fiili seç.- Yalnızca
state,countyve içindepovertygeçen sütunları tutmak için doğru fiili seç. - Nüfusta kadınların oranını gösteren
fraction_womenadlı yeni bir sütun hesapla; hiçbir sütunu düşürme. - Yalnızca üç sütun tut:
state,countyveemployed / population; bu sütunaemployment_rateadını vereceksin.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
# Change the name of the unemployment column
counties %>%
___(unemployment_rate = unemployment)
# Keep the state and county columns, and the columns containing poverty
counties %>%
___(state, county, contains("poverty"))
# Calculate the fraction_women column without dropping the other columns
counties %>%
___(fraction_women = women / population)
# Move the region column to before state
counties %>%
___(region, .before = state)