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

Constant Fill

Constant fill is a useful method of imputation when the missing, NA values in a dataset can be assumed to be a certain value. Sometimes when moving data between different platforms and software, certain values in the data may be 'lost' or flagged as NA erroneously. Using constant fill imputation lets you replace these missing values with a default.

In this exercise, you'll impute missing values for the car_sales time series, which represents daily car sales for an employee at a car dealership.

Bu egzersiz, kursun bir parçasıdır

Manipulating Time Series Data in R

Kursa Göz Atın

Egzersiz talimatları

  • Determine the total number of NA values in the car_sales time series.

  • Use constant fill imputation to fill the missing values of car_sales with 0; assign this to the car_sales_filled variable.

  • Autoplot the car_sales_filled time series.

Uygulamalı etkileşimli egzersiz

Bu egzersizi bu örnek kodu tamamlayarak deneyin.

# Add together the number of NA values
___

# Fill in missing values with zero
___ <- ___

# Autoplot the filled time series
autoplot(___) + 
  labs(y = "Daily Car Sales") + 
  theme_light()
Kodu Düzenle ve Çalıştır