Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
R for Data Science

You're reading from   R for Data Science Learn and explore the fundamentals of data science with R

Arrow left icon
Product type Paperback
Published in Dec 2014
Publisher
ISBN-13 9781784390860
Length 364 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Dan Toomey Dan Toomey
Author Profile Icon Dan Toomey
Dan Toomey
Arrow right icon
View More author details
Toc

Automatic forecasting packages

In R, there are several packages that provide plotting for the programmer. We will be using the following packages in the examples:

  • forecast: This package is used to forecast functions for time series and linear models
  • TTR: This package has functions and data to create technical trading rules

Time series

In R programming, a time series is a sequence of data points measured evenly over uniform time intervals—typically, monthly or yearly frequencies are used. You can coerce (convert) a standard dataset into a time series using the as.ts function.

For the initial time series, we will use the Fraser River monthly flows (available at http://www.cmu.edu). I couldn't find a source for the dataset, so I copied it from the site to a local file. The data is the monthly flow starting from March 1913. There are over 900 measurements. The data has a definite frequency:

> fraser <- scan("fraser.txt")
Read 946 items

If we look at the data with a standard...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime