MulaiMulai sekarang secara gratis

Parsing and formatting dates

An essential early step in working with "raw" time series data (usually a data frame column or vector of observations) is to make sure all of your dates are in the same "date format". This is especially true when your data comes from multiple sources.

In this exercise, you'll practice formatting dates in two ways, using lubridate. First, you'll convert the dates object, a character vector, into a vector of class Date. Second, you'll reformat dates_order, an object which contains inconsistent date formatting.

The dates and dates_order objects, and the lubridate package, are loaded for you.

Latihan ini adalah bagian dari kursus

Manipulating Time Series Data in R

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Print the class of the dates object
___
Edit dan Jalankan Kode