Identifying the sampling frequency
In addition to viewing your data and plotting over time, there are several additional operations that can be performed on time series datasets.
The start()
and end()
functions return the time index of the first and last observations, respectively. The time()
function calculates a vector of time indices, with one element for each time index on which the series was observed.
The deltat()
function returns the fixed time interval between observations and the frequency()
function returns the number of observations per unit time. Finally, the cycle()
function returns the position in the cycle of each observation.
In this exercise, you'll practice applying these functions to the AirPassengers
dataset, which reports the monthly total international airline passengers (in thousands) from 1949 to 1960.
Diese Übung ist Teil des Kurses
Time Series Analysis in R
Anleitung zur Übung
- Begin by plotting the
AirPassengers
data using a simple call toplot()
. - Next, list the first and last time observations in
AirPassengers
usingstart()
andend()
, respectively. - Finally, gain some additional insight into this dataset by using the
time()
,deltat()
,frequency()
, andcycle()
commandsAirPassengers
.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# Plot AirPassengers
# View the start and end dates of AirPassengers
# Use time(), deltat(), frequency(), and cycle() with AirPassengers