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

Completing the Solar System

You have been given a data frame (planet_df) from the devstronomy project with the number of moons per planet in our Solar System. However, Mercury and Venus, the two moonless planets, are absent. You want to expand this dataset using the complete() function and a vector planets that contains all eight planet's names.

Bu egzersiz

Reshaping Data with tidyr

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

Egzersiz talimatları

  • Complete the planet variable using the planets vector.
  • Replace NA values in the n_moons variable with 0L values.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

planets = c("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune")

planet_df %>% 
  complete(
    # Complete the planet variable
    ___,
    # Overwrite NA values for n_moons with 0L
    ___
  )
Kodu Düzenle ve Çalıştır