Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Map a column of class Date
to the x- or y-axis. We’ll use the economics data set for this example:
# Look at the structurestr(economics)'data.frame':478obs. of6variables:$date : Date,format:"1967-06-30""1967-07-31"...$pce : num508511517513518...$pop : int198712198911199113199311199498199657199808199920...$psavert : num9.89.899.89.79.499.58.99.6...$uempmed : num4.54.74.64.94.74.85.14.54.14.6...$unemploy: int2944294529583143306630182878300128772709...
The column date is an object
of class Date, and mapping it to
x will produce the result shown in
Figure 8-37: