Session Ready
Exercise

Time series object

Many companies gather time-dependent data to look for trends or seasonal variations. As time is irregular, wrangling time-dependent data might be hard, especially in a stressful setting, such as a job interview.

Coercing data to a time series object makes it easier to analyze such datasets.

The xts object takes the following arguments:

  • x - a set of values,
  • order.by - a set of corresponding dates (which need to be of the Date class).

In this exercise, you will work with natural gas prices. The dataset contains two variables:

  • Price - numerical values,
  • Date - dates stored as factors.

The gas dataset is available in your environment.

Instructions 1/2
undefined XP
  • 1
  • 2
  • Display the structure of the gas dataset; what class is the Date column?
  • Coerce the Date column to a date class.