Machine Learning with R Cookbook - Second Edition
by AshishSingh Bhatia, Yu-Wei, Chiu (David Chiu)
How it works...
The head and tail functions lets you extract data from the start and end part from the datasets. The head and tail serve a purpose only if you know the numbers of the data points to be extracted. For example, get 10 data at the start or at the end of the dataset. But this will be not always be the case. In time series, you may want to extract data in a form such as extracting the last 3 months of data or 3 weeks of data, and so on. It will be tedious with head and tail functions to find the exact number. The zoo and xts package provides the first and last functions that can be used to extract data from the time series in the required fashion. Using this function, you can clearly extract data for 3 months, 3 years, and so on. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access