LoslegenKostenlos loslegen

Creating a zoo

zoo objects are an essential tool in the time series analyst tool belt; many advanced functions in time series analysis require time series objects. Creating a zoo object from a vector or data frame is the first step in ensuring your data is ready for a time series analysis!

In this exercise, you'll create and visualize a time series of the average price of a particular card from a popular trading card game.

You'll use the core data stored in the vector cards_price, as well as the index vector cards_index, containing the date that each price was sampled.

cards_index, cards_price, and the zoo and ggplot2 packages are available to use.

Diese Übung ist Teil des Kurses

Manipulating Time Series Data in R

Kurs anzeigen

Anleitung zur Übung

  • Return the head, or first six observations from cards_index.

  • Return the head, or first six observations from cards_price.

  • Generate a zoo object from your index and core data vectors, and assign it to cards_zoo.

  • Generate an autoplot of cards_zoo.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Return the head of cards_index
___

# Return the head of cards_price
___

# Create a zoo object: cards_zoo
___ <- ___(x = ___, order.by = ___)

# Autoplot cards_zoo
___
Code bearbeiten und ausführen