Kaç tane eksik değer var?
Yeni bir veri kümesiyle çalışırken ilk kontrol etmek isteyeceğin şeylerden biri, eksik değer olup olmadığı ve kaç tane olduğudur.
Eksik değerleri saymak için are_na() kullanabilirsin, ancak eksikleri saymanın en verimli yolu n_miss() fonksiyonunu kullanmaktır. Bu fonksiyon sana verideki toplam eksik değer sayısını verir.
Verideki eksik değerlerin yüzdesini pct_miss fonksiyonu ile bulabilirsin. Bu, verideki eksik değerlerin yüzdesini verir.
Bunların tamamlayıcısını — yani kaç tane tam (eksiksiz) değer olduğunu — n_complete ve pct_complete ile de bulabilirsin.
Bu egzersiz, kursun bir parçasıdır
R'de Eksik Verilerle Başa Çıkma
Egzersiz talimatları
Boy ve kilo örnek veri çerçevesi dat_hw'yi kullanarak:
- Veri çerçevesindeki toplam eksik değer sayısını bulmak için
dat_hwüzerinden_miss()kullan. - Değişken
dat_hw$weightüzerindeki toplam eksik değer sayısını bulmak içinn_miss()kullan. - Benzer şekilde, veri çerçevesi ve değişkenler için eksiklerin oranını ve tam değerlerin sayı ile oranını almak üzere
prop_miss(),n_complete()veprop_complete()kullan.
Uygulamalı etkileşimli egzersiz
Bu egzersizi bu örnek kodu tamamlayarak deneyin.
# Use n_miss() to count the total number of missing values in dat_hw
n_miss(___)
# Use n_miss() on dat_hw$weight to count the total number of missing values
n_miss(___$___)
# Use n_complete() on dat_hw to count the total number of complete values
n_complete(___)
# Use n_complete() on dat_hw$weight to count the total number of complete values
___(___$___)
# Use prop_miss() and prop_complete() on dat_hw to count the total number of missing values in each of the variables
prop_miss(____)
prop_complete(___)